使用javadoc:test-javadoc的Maven 3站点插件问题

时间:2013-03-22 00:51:51

标签: maven-3 maven-site-plugin maven-javadoc-plugin

我是Maven的新手,所以请耐心等待。 我继承了这个多模块项目,我的老板希望我利用网站插件以及其他常用的插件,如javadoc,jxr和surefire-report。这些报告仅针对我们的测试源代码生成。

这是我的父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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>oracle.apps.hcm.hwr</groupId>
    <artifactId>hwr-parent</artifactId>
    <packaging>pom</packaging>
    <version>3.0.0-SNAPSHOT</version>
    <description>my parent pom</description>
    <properties>
        <abdera.version>0.4.0-incubating</abdera.version>
        <adfm.version>11.1.1.5.37.60.13</adfm.version>
        <applcore.version>1.0</applcore.version>
        <axis2.version>1.3</axis2.version>
        <bcprov-jdk16.version>145</bcprov-jdk16.version>
        <cglib.version>2.2.2</cglib.version>
        <commons-cli.version>1.2</commons-cli.version>
        <commons-codec.version>1.3</commons-codec.version>
        <commons-collections.version>3.2</commons-collections.version>
        <commons-configuration.version>1.4</commons-configuration.version>
        <commons-dbcp.version>1.4</commons-dbcp.version>
        <commons-lang.version>2.2</commons-lang.version>
        <commons-logging.version>1.1</commons-logging.version>
        <easymock.version>3.1</easymock.version>
        <grc-project.version>8.6.4.7-SNAPSHOT</grc-project.version>
        <hcm-amWrapper.version>1.0</hcm-amWrapper.version>
        <hcm-publicEntityObjects.version>1.0</hcm-publicEntityObjects.version>
        <httpclient.version>4.0.1</httpclient.version>
        <je.version>4.1.20</je.version>
        <json-simple.version>1.1.1</json-simple.version> 
        <java.version>1.6</java.version>
        <junit.version>4.4</junit.version>
        <log4j.version>1.2.14</log4j.version>
        <maven-checkstyle-plugin.version>2.9.1</maven-checkstyle-plugin.version>
        <maven-antrun-plugin.version>1.6</maven-antrun-plugin.version>
        <maven-javadoc-plugin.version>2.9</maven-javadoc-plugin.version>
        <maven-jxr-plugin.version>2.3</maven-jxr-plugin.version>
        <maven-project-info-reports-plugin.version>2.4</maven-project-info-reports-plugin.version>
        <maven-surefire-plugin.version>2.12.4</maven-surefire-plugin.version>
        <maven-surefire-report-plugin.version>2.12.4</maven-surefire-report-plugin.version>
        <maven-war-plugin.version>2.3</maven-war-plugin.version>
        <maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
                <maven-jar-plugin.version>2.4</maven-jar-plugin.version>
                <maven-dependency-plugin.version>2.6</maven-dependency-plugin.version>
                <maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
                <maven-resources-plugin.version>2.6</maven-resources-plugin.version>
                <build-helper-maven-plugin.version>1.7</build-helper-maven-plugin.version>
        <ojdbc6.version>11.1.0.7.0</ojdbc6.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <quartz.version>1.6.5</quartz.version>
        <repository.url.root>localhost:8082/nexus</repository.url.root>
        <scm.connection.root>scm:svn:svn://localhost</scm.connection.root>
        <scm.url>localhost/viewvc</scm.url>
        <servlet-api.version>2.5</servlet-api.version>
        <signpost.version>1.2.1.2</signpost.version>
        <skip.integration.tests>true</skip.integration.tests>
        <spring.version>2.5.6</spring.version>
        <surefire-junit47.version>2.12</surefire-junit47.version>
        <tagbase.url.root>svn://localhost</tagbase.url.root>
        <wagon-ftp.version>1.0-beta-2</wagon-ftp.version>
        <wagon-ssh-external.version>1.0-alpha-5</wagon-ssh-external.version>
        <openrdf-sesame.version>2.2.4</openrdf-sesame.version>
        <hwr-project.version>3.0.0-SNAPSHOT</hwr-project.version>
        <not-approved-jar-dependencies>**/xstream-*,**/aopalliance-*,**/jsr305-*,**/guice-*,**/*-guice-*,**/guava-*,**/*-guava-*,**/jackson-*,**/xpp3*,**/commons-beanutils-*,**/slf4j-*,**/spring-asm-*,**/spring-expression-*,**/twitter4j-core-*</not-approved-jar-dependencies>
    </properties>
    <scm>
        <url>${scm.connection.root}/Hcm/trunk</url>
        <connection>${scm.connection.root}/HcmWorkforceReputation/trunk</connection>
        <developerConnection>${scm.connection.root}/HcmWorkforceReputation/trunk</developerConnection>
    </scm>
    <repositories>
        <repository>
            <id>public</id>
            <url>${repository.url.root}/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>public</id>
            <url>${repository.url.root}/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>
    <organization>
        <name>my org</name>
        <url>http://localhost</url>
    </organization>
    <build>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>${wagon-ftp.version}</version>
            </extension>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh-external</artifactId>
                <version>${wagon-ssh-external.version}</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${maven-antrun-plugin.version}</version>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.0</version>
              <configuration>
                <stagingDirectory>/lapps/ag1/site/site</stagingDirectory>
                <reportPlugins>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.2</version>
                    <reports>
                      <report>index</report>
                      <report>project-team</report>
                      <report>license</report>
                      <report>mailing-list</report>
                      <report>dependencies</report>
                      <report>dependency-convergence</report>
                      <report>plugin-management</report>
                      <report>cim</report>
                      <report>issue-tracking</report>
                      <report>scm</report>
                      <report>summary</report>
                    </reports>
                  </plugin>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>2.6</version>
                  </plugin>
                  <plugin> 
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                    <aggregate>false</aggregate>
                    </configuration>
                  </plugin>      
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin.version}</version>
                  </plugin>
                  <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jdepend-maven-plugin</artifactId>
                    <version>2.0-beta-2</version>
                  </plugin>
                  <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>2.4</version>
                  </plugin>
                  <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>taglist-maven-plugin</artifactId>
                    <version>2.4</version>
                  </plugin>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <version>2.1</version>
                  </plugin>
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                      <linkXref>true</linkXref>
                      <minimumTokens>100</minimumTokens>
                      <minimumPriority>3</minimumPriority>
                      <!-- Change minimum priority to see more or less messages -->
                      <targetJdk>1.6</targetJdk>
                    </configuration>
                  </plugin>
                </reportPlugins>
              </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven-project-info-reports-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
            </plugin>
            <plugin> 
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                    <aggregate>false</aggregate>
                    </configuration>
                  </plugin>      
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
            </testResource>
        </testResources>
    </build>


    <!-- Used when deploying to internal m2 repository. You must have a corresponding 
        repository defined in your settings.xml. Unless you are the build machine 
        or a project lead, you needn't worry about this. -->
    <distributionManagement>
        <site>
       <id>${project.artifactId}-site</id>
       <url>./</url>
        </site>
        <repository>
            <id>releases</id>
            <name>LogicalApps internal remote maven repository</name>
            <url>${repository.url.root}/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <uniqueVersion>false</uniqueVersion>
            <id>snapshots</id>
            <name>LogicalApps internal remote maven snapshot repository</name>
            <url>${repository.url.root}/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
    <dependencyManagement>


    <dependencies>
        <!-- Common dependencies -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging-api</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>
</project>

我使用以下方式从Hudson运行它:

-Dmaven.test.failure.ignore=true clean install javadoc:test-javadoc jxr:test-jxr surefire-report:report-only site site:stage

这是我不断得到的错误:

17:14:40  [INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project hwr-parent: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin
17:14:41  [DEBUG] Closing connection to remote
17:14:41  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project hwr-parent: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Failed to execute goal com.github.goldin:copy-maven-plugin:0.2.5:copy (copy-ear-to-jar) on project hwr-wlapp-jar: Processing <resource> [Target path(s) [/lapps/hudson/workspace/Navid-HWR/hwr-whitelabelapp/hwr-wlapp-jar/target/classes/], directory [/lapps/hudson/workspace/Navid-HWR/hwr-whitelabelapp/hwr-wlapp-ear/target], dependencies []] failed with [java.lang.AssertionError]: No [**/*.ear] file(s) found in [/lapps/hudson/workspace/Navid-HWR/hwr-whitelabelapp/hwr-wlapp-ear/target], excludes pattern is [**/#*#, **/%*%, **/*.iml, **/*.ipr, **/*.iws, **/*~, **/-darcs-backup*, **/.#*, **/.DS_Store, **/.MySCMServerInfo, **/._*, **/.arch-ids, **/.arch-ids/**, **/.bzr, **/.bzr/**, **/.bzrignore, **/.classpath, **/.cvsignore, **/.darcs-temp-mail, **/.darcsrepo, **/.darcsrepo/**, **/.git, **/.git/**, **/.gitattributes, **/.gitignore, **/.gitmodules, **/.hg, **/.hg/**, **/.hgignore, **/.hgsub, **/.hgsubstate, **/.hgtags, **/.metadata, **/.metadata/**, **/.project, **/.settings/**, **/.svn, **/.svn/**, **/BitKeeper, **/BitKeeper/**, **/CVS, **/CVS/**, **/ChangeSet, **/ChangeSet/**, **/RCS, **/RCS/**, **/SCCS, **/SCCS/**, **/_darcs, **/_darcs/**, **/project.pj, **/vssver.scc].. Expression: (files || failIfNotFound). Values: files = [], failIfNotFound = true -> [Help 1]

编辑: 每个请求这里是hwr-wlapp-ear的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>
    <artifactId>hwr-wlapp-jar</artifactId>
    <description>Project for white label app ui</description>

    <packaging>jar</packaging>

    <parent>
        <groupId>oracle.apps.hcm.hwr.wlapp</groupId>
        <artifactId>hwr-whitelabelapp</artifactId>
        <relativePath>../</relativePath>
        <version>3.0.0-SNAPSHOT</version>
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.goldin</groupId>
                <artifactId>copy-maven-plugin</artifactId>
                <version>0.2.5</version>
                <executions>
                    <execution>
                        <id>copy-ear-to-jar</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <!-- Copy the ear file -->
                                <resource>
                                    <targetPath>${project.build.outputDirectory}/</targetPath>
                                    <directory>${project.basedir}/../hwr-wlapp-ear/target/</directory>
                                    <includes>
                                        <include>**/*.ear</include>
                                    </includes>
                                    <failIfNotFound>true</failIfNotFound>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>oracle.apps.hcm.hwr.wlapp</groupId>
            <artifactId>hwr-wlapp-ear</artifactId>
            <type>ear</type>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</project>

这是hwr-wlapp-ear的父母的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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>oracle.apps.hcm.hwr.wlapp</groupId>
    <artifactId>hwr-whitelabelapp</artifactId>
    <packaging>pom</packaging>

    <version>3.0.0-SNAPSHOT</version>

    <name>hwr-whitelabelapp</name>

    <parent>
        <groupId>oracle.apps.hcm.hwr</groupId>
        <artifactId>hwr-parent</artifactId>
        <relativePath>../hwr-parent</relativePath>
        <version>3.0.0-SNAPSHOT</version>
    </parent>

    <organization>
        <name>Oracle</name>
        <url>http://www.oracle.com</url>
    </organization>

    <modules>
        <module>WhiteLabelApp</module>
        <module>hwr-wlapp-ear</module>
        <module>hwr-wlapp-jar</module>
    </modules>

</project>

有人可以给我一些指示,为什么会发生这种情况以及如何解决它?

1 个答案:

答案 0 :(得分:1)

可能的根本原因是没有要从${project.basedir}/../hwr-wlapp-ear/target/**/*.ear复制的ear文件。

这可能是在执行hwr-wlapp-ear project之前hwr-wlapp-jar project应该执行和存在的依赖项。

如果我错了,请纠正我。我知道您只执行hwr-wlapp-jar project。有两种方法可以解决此问题

  1. 从父项目文件夹(hwr-whitelabelapp)执行maven命令。

  2. 首先仅执行maven命令hwr-wlapp-ear project,以便存在ear文件。然后执行hwr-wlapp-jar project

  3. 我希望这可能有所帮助。