0

我有一个项目,我使用 maven 编译:mvn clean compile. Java 文件的总数约为 2000 个。

编译成功,但部分Java文件没有生成类。

我使用 Maven 3.0.4。系统是Linux。

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
               <!--<version>3.0</version>-->
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <verbose>true</verbose>
                    <encoding>GBK</encoding>

                    <compilerArguments>
                        <sourcepath>${project.build.sourceDirectory}</sourcepath>
                        <extdirs>${project.basedir}/src/lib </extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

有效的 pom :

<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>
      <parent>
        <groupId>com.xxoo</groupId>
        <artifactId>xxooroot</artifactId>
        <version>1.0-SNAPSHOT</version>
      </parent>
      <groupId>com.xxoo</groupId>
      <artifactId>xxoodev</artifactId>
      <version>1.0-SNAPSHOT</version>
      <description>the root pom for all maven project</description>
      <distributionManagement>
        <repository>
          <id>nexus-releases</id>
          <name>Internal Release Repository</name>
          <url>http://ip/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
          <id>nexus-snapshots</id>
          <name>Internal Snapshot Repository</name>
          <url>http://ip/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>
      <properties>
        <aspectj.version>1.6.2</aspectj.version>
        <checkstyle.url>/home/tony/.config/maven_checks.xml</checkstyle.url>
        <cobertura.encoding>UTF-8</cobertura.encoding>
        <compile.encoding>UTF-8</compile.encoding>
        <compile.source>1.6</compile.source>
        <compile.target>1.6</compile.target>
        <junit.version>4.8.2</junit.version>
        <pmd.sourceEncoding>UTF-8</pmd.sourceEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <resource.log4j>log4j.*</resource.log4j>
        <resources.encoding>UTF-8</resources.encoding>
        <slf4j.version>1.7.2</slf4j.version>
        <spring.version>3.1.3.RELEASE</spring.version>
      </properties>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <version>1.0</version>
          </dependency>
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
          </dependency>
          <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
          </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.1.3.RELEASE</version>
          </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.1.3.RELEASE</version>
          </dependency>
                 omitted....
      </dependencies>
      <repositories>
        <repository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
          <id>central</id>
          <url>http://central</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>central</id>
          <url>http://central</url>
        </pluginRepository>
      </pluginRepositories>
      <build>
        <sourceDirectory>/opt/myself/xxoosource/xxoodev/src/main/java</sourceDirectory>
        <scriptSourceDirectory>/opt/myself/xxoosource
     /xxoodev/src/main/scripts</scriptSourceDirectory>
        <testSourceDirectory>/opt/myself/xxoosource/xxoodev/src
    /test /java</testSourceDirectory>
        <outputDirectory>/opt/myself/xxoosource/xxoodev/target/classes</outputDirectory>
        <testOutputDirectory>/opt/myself/xxoosource/xxoodev/target
    /test-classes</testOutputDirectory>
        <defaultGoal>package</defaultGoal>
        <resources>
          <resource>
            <filtering>true</filtering>
            <directory>/opt/myself/xxoosource/xxoodev/src/main/resources</directory>
            <excludes>
              <exclude>log4j.*</exclude>
            </excludes>
          </resource>
          <resource>
            <directory>/opt/myself/xxoosource/xxoodev/src/main/java</directory>
            <includes>
              <include>**/*.xml</include>
            </includes>
            <excludes>
              <exclude>log4j.*</exclude>
            </excludes>
          </resource>
        </resources>
        <testResources>
          <testResource>
            <filtering>true</filtering>
            <directory>/opt/myself/xxoosource/xxoodev/src/test/resources</directory>
          </testResource>
          <testResource>
            <directory>/opt/myself/xxoosource/xxoodev/src/test/java</directory>
            <includes>
              <include>**/*.properties</include>
              <include>**/*.xml</include>
            </includes>
          </testResource>
        </testResources>
        <directory>/opt/myself/xxoosource/xxoodev/target</directory>
        <finalName>xxoodev-1.0-SNAPSHOT</finalName>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>1.3</version>
            </plugin>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <version>2.3</version>
            </plugin>
            <plugin>
              <groupId>org.mortbay.jetty</groupId>
              <artifactId>maven-jetty-plugin</artifactId>
              <version>6.1.7</version>
            </plugin>
                  omitted....
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>cobertura-maven-plugin</artifactId>
              <version>2.5</version>
              <configuration>
                <encoding>UTF-8</encoding>
                <formats>
                  <format>xml</format>
                </formats>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-pmd-plugin</artifactId>
              <version>2.5</version>
              <configuration>
                <linkXref>false</linkXref>
                <sourceEncoding>UTF-8</sourceEncoding>
                <minimumTokens>100</minimumTokens>
                <targetJdk>1.6</targetJdk>
                <excludes>
                  <exclude>**/generated/*.java</exclude>
                </excludes>
                <excludeRoots>
                  <excludeRoot>target/generated-sources/stubs</excludeRoot>
                </excludeRoots>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-war-plugin</artifactId>
              <version>2.1.1</version>
            </plugin>
            <plugin>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.2</version>
            </plugin>
            <plugin>
              <artifactId>maven-release-plugin</artifactId>
              <version>2.0</version>
            </plugin>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.5</version>
            </plugin>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>2.3.2</version>
            </plugin>
            <plugin>
              <artifactId>maven-deploy-plugin</artifactId>
              <version>2.6</version>
            </plugin>
            <plugin>
              <artifactId>maven-install-plugin</artifactId>
              <version>2.3.1</version>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.5</version>
            <executions>
              <execution>
                <id>default-resources</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>resources</goal>
                </goals>
                <configuration>
                  <encoding>UTF-8</encoding>
                </configuration>
              </execution>
              <execution>
                <id>default-testResources</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>testResources</goal>
                </goals>
                <configuration>
                  <encoding>UTF-8</encoding>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <encoding>UTF-8</encoding>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <executions>
              <execution>
                <id>default-testCompile</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <source>1.5</source>
                  <target>1.5</target>
                  <verbose>true</verbose>
                  <encoding>GBK</encoding>
                  <compilerArguments>
                    <sourcepath>/opt/myself/xxoosource/xxoodev/src
    /main/java</sourcepath>
                    <extdirs>/opt/myself/xxoosource/xxoodev/src/lib</extdirs>
                  </compilerArguments>
                </configuration>
              </execution>
              <execution>
                <id>default-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <source>1.5</source>
                  <target>1.5</target>
                  <verbose>true</verbose>
                  <encoding>GBK</encoding>
                  <compilerArguments>
                    <sourcepath>/opt/myself/xxoosource/xxoodev/src
    /main/java</sourcepath>
                    <extdirs>/opt/myself/xxoosource/xxoodev/src/lib</extdirs>
                  </compilerArguments>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
              <verbose>true</verbose>
              <encoding>GBK</encoding>
              <compilerArguments>
                <sourcepath>/opt/myself/xxoosource/xxoodev/src/main/java</sourcepath>
                <extdirs>/opt/myself/xxoosource/xxoodev/src/lib</extdirs>
              </compilerArguments>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
            <executions>
              <execution>
                <id>default-jar</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <archive>
                    <manifestEntries>
                      <Build-Date>${__now}</Build-Date>
                      <SCM-Revision>${__revision}</SCM-Revision>
                      <SCM-Url>${__fullurl}</SCM-Url>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <archive>
                <manifestEntries>
                  <Build-Date>${__now}</Build-Date>
                  <SCM-Revision>${__revision}</SCM-Revision>
                  <SCM-Url>${__fullurl}</SCM-Url>
                </manifestEntries>
              </archive>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
               <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.3.2</version>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.8</version>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.5</version>
            <configuration>
              <encoding>UTF-8</encoding>
              <formats>
                <format>xml</format>
              </formats>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>2.5</version>
            <configuration>
              <linkXref>false</linkXref>
              <sourceEncoding>UTF-8</sourceEncoding>
              <minimumTokens>100</minimumTokens>
              <targetJdk>1.6</targetJdk>
              <excludes>
                <exclude>**/generated/*.java</exclude>
              </excludes>
              <excludeRoots>
                <excludeRoot>target/generated-sources/stubs</excludeRoot>
              </excludeRoots>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
              <execution>
                <id>default-clean</id>
                <phase>clean</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
              <execution>
                <id>default-install</id>
                <phase>install</phase>
                <goals>
                  <goal>install</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <executions>
              <execution>
                <id>default-test</id>
                <phase>test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.6</version>
            <executions>
              <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0</version>
            <executions>
              <execution>
                <id>default-site</id>
                <phase>site</phase>
                <goals>
                  <goal>site</goal>
                </goals>
                <configuration>
                  <outputDirectory>/opt/myself/xxoosource/xxoodev
    /target/site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
              <execution>
                <id>default-deploy</id>
                <phase>site-deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
                <configuration>
                  <outputDirectory>/opt/myself/xxoosource/xxoodev
    /target/site</outputDirectory>
                  <reportPlugins>
                    <reportPlugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-project-info-reports-plugin</artifactId>
                    </reportPlugin>
                  </reportPlugins>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <outputDirectory>/opt/myself/xxoosource/xxoodev
    /target/site</outputDirectory>
              <reportPlugins>
                <reportPlugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-project-info-reports-plugin</artifactId>
                </reportPlugin>
              </reportPlugins>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <outputDirectory>/opt/myself/xxoosource/xxoodev/target/site</outputDirectory>
      </reporting>
    </project>
4

1 回答 1

0

导航到项目的主目录。然后将目录更改为target,应该有class文件。

于 2013-01-21T13:25:10.873 回答