Maven Project类无法编译

时间:2018-12-13 16:39:32

标签: java maven compilation pom.xml

我有一个使用Repast Simphony模拟的Maven项目。目的是在运行良好的浏览器中显示模拟。模拟本身已经预先编译,并且可以按预期进行。现在,我想在其中一个类中更改函数,但是Eclipse不会更改。

我的项目设置如下:

Project
 -src/main/java   <- My Rest Service
 -src/main/resources    <- My HTML, JS, CSS, etc
 -repastSource    <- My Repast simulation
 -target   <- Where the .class files land
 -lib  <- external .jars

在repastSource文件夹中,有许多带有.java-Files的软件包。这些类不会被编译,因为当我在目标中检查.class文件时,它们仍具有旧的更改日期。我显然以某种方式编译了它们,但是我不确定如何做到这一点。我对Maven还是很陌生,感谢您的帮助。

当我以清洁为目标运行我的项目时,请从目标文件夹中删除repastSimulation .class文件。

这是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>adaptpro.webapplication</groupId>
    <artifactId>webapplication</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>webapplication</name>
    <description>WebApplication</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
    <exclusion>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-to-slf4j</artifactId>
    </exclusion>
    </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
        <groupId>agent</groupId>
        <artifactId>discourse</artifactId>
        <scope>system</scope>
        <version>1</version>
        <systemPath>${basedir}/lib/DiscourseAgent.jar</systemPath>
    </dependency>

     <dependency>
        <groupId>repast.simphony</groupId>
        <artifactId>repast.simphony</artifactId>
        <scope>system</scope>
        <version>1</version>
        <systemPath>${basedir}/lib/repast.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>colt</groupId>
        <artifactId>colt</artifactId>
        <version>1.2.0</version>
</dependency>
<dependency>
   <groupId>cglib</groupId>
   <artifactId>cglib</artifactId>
   <version>3.2.4</version>
</dependency>

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-collections4</artifactId>
    <version>4.2</version>
</dependency>


     <dependency>
        <groupId>org.apache</groupId>
        <artifactId>collections</artifactId>
        <scope>system</scope>
        <version>1</version>
        <systemPath>${basedir}/lib/collections-generic-4.01.jar</systemPath>
    </dependency>
     <dependency>
        <groupId>event</groupId>
        <artifactId>event</artifactId>
        <scope>system</scope>
        <version>1</version>
        <systemPath>${basedir}/lib/saf.core.runtime.jar</systemPath>
    </dependency>
     <dependency>
        <groupId>net.sf.jpf</groupId>
        <artifactId>jpf</artifactId>
        <scope>system</scope>
        <version>1</version>
        <systemPath>${basedir}/lib/jpf-1.5.jar</systemPath>
    </dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.11.1</version>
</dependency>
<dependency>
    <groupId>com.thoughtworks.xstream</groupId>
    <artifactId>xstream</artifactId>
    <version>1.4.10</version>
</dependency>

     <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-1.2-api</artifactId>
        <scope>system</scope>
        <version>2.11.1</version>
        <systemPath>${basedir}/lib/apache-log4j-2.11.1-bin/log4j-1.2-api-2.11.1.jar</systemPath>
    </dependency>
    <dependency>
   <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.12.1.GA</version>
</dependency>

<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-api</artifactId>
  <version>2.11.1</version>
</dependency>
    </dependencies>

    <build>
  <resources>
    <resource>
      <directory>${project.basedir}/src/main/resources</directory>
    </resource>

    <resource>
      <directory>${project.build.directory}/generated-resources</directory>
    </resource>
  </resources>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <executions>
        <execution>
          <!-- Serves *only* to filter the wro.xml so it can get an absolute 
        path for the project -->
          <id>copy-resources</id>
          <phase>validate</phase>
          <goals>
            <goal>copy-resources</goal>
          </goals>
          <configuration>
            <outputDirectory>${basedir}/target/wro</outputDirectory>
            <resources>
              <resource>
                <directory>src/main/wro</directory>
                <filtering>true</filtering>
          </resource>
        </resources>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>ro.isdc.wro4j</groupId>
  <artifactId>wro4j-maven-plugin</artifactId>
  <version>1.7.6</version>
  <executions>
    <execution>
      <phase>generate-resources</phase>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
    <cssDestinationFolder>${project.build.directory}/generated-resources/static/css</cssDestinationFolder>
    <jsDestinationFolder>${project.build.directory}/generated-resources/static/js</jsDestinationFolder>
    <wroFile>${project.build.directory}/wro/wro.xml</wroFile>
    <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
    <contextFolder>${basedir}/src/main/wro</contextFolder>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery</artifactId>
      <version>2.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>angularjs</artifactId>
      <version>1.3.8</version>
    </dependency>
    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>bootstrap</artifactId>
      <version>3.2.0</version>
    </dependency>

  </dependencies>
</plugin>

预先感谢

科尼希施泰因

1 个答案:

答案 0 :(得分:0)

谢谢Daniele,那是我的错误。有时很容易:D