2013-03-22 89 views
0

我是Maven新手,請耐心等待。 我繼承了這個多模塊項目,我的老闆希望我可以使用網站插件以及其他常用插件,如javadoc,jxr和surefire-report。這些報告只會爲我們的測試源代碼生成。Maven 3插件與javadoc問題:test-javadoc

這是我父母的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> 

而且我使用哈德森運行:

-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耳的父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> 

有人可以給我一些指點因爲爲什麼發生這種情況以及我如何解決這個問題?

+0

它可能不是一個javadoc插件問題,因爲堆棧跟蹤告訴我們'無法執行目標com.github.goldin:copy-maven-plugin:0.2.5:copy(copy-ear-to-jar)on項目hwr-wlapp-jar'和'failed [java.lang.AssertionError]:沒有[**/*。ear]文件(s)在......中找到。請提供關於'com.github.goldin:copy-maven-plugin:0.2.5'的相關pom。 – 2013-03-22 01:35:56

+0

謝謝,添加了pom.xml – Codrguy 2013-03-22 01:51:56

回答

1

可能的根本原因是沒有ear文件從${project.basedir}/../hwr-wlapp-ear/target/**/*.ear複製。

這可能是hwr-wlapp-ear project在執行hwr-wlapp-jar project之前應該執行並存在的依賴關係。

如果我錯了,請糾正我。我知道你只執行hwr-wlapp-jar project。有2點可能的方式來解決這個問題,因爲

  1. 從父項目文件夾(hwr-whitelabelapp)執行的Maven命令。

  2. 首先執行maven命令只有hwr-wlapp-ear project以便ear文件存在。然後執行hwr-wlapp-jar project

我希望這可以幫助。