当我尝试构建站点时,我目前面临 Maven 3 的以下问题。我会感谢你在这方面的帮助。
mvn 清洁网站
..........
[INFO] Reactor Summary:
[INFO]
[INFO] Project A ......................................... SUCCESS [15.383s]
[INFO] Project B ......................................... SUCCESS [2.232s]
[INFO] My Site ........................................... FAILURE [0.105s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.769s
[INFO] Finished at: Fri Jun 29 14:26:04 AMT 2012
[INFO] Final Memory: 18M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.1:site (default-site) on project site: SiteToolException: Unable to read local module-POM: 1 problem was encountered while building the effective model for my.com:projA:0.1-SNAPSHOT
[ERROR] [FATAL] Non-resolvable parent POM: Could not find artifact my.com:parent-pom:pom:0.1-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 12, column 13
[ERROR] for project my.com:projA:0.1-SNAPSHOT
.............
首先是配置:
Apache Maven 3.0.4 (r1232337; 2012-01-17 12:44:56+0400)
Java version: 1.7.0_04, vendor: Oracle Corporation
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
Nexus repository: 2.0.6
父 POM:
<modelVersion>4.0.0</modelVersion>
<name>Parent POM</name>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
聚合项目pom:
<modelVersion>4.0.0</modelVersion>
<name>My Site</name>
<groupId>my.com</groupId>
<artifactId>site</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
<modules>
<module>projA</module>
<module>projB</module>
</modules>
项目A的pom:
<modelVersion>4.0.0</modelVersion>
<name>Project A</name>
<groupId>my.com</groupId>
<artifactId>projA</artifactId>
<version>0.1-SNAPSHOT</version>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
项目 B 的 pom:
4.0.0
<name>Project B</name>
<groupId>my.com</groupId>
<artifactId>projB</artifactId>
<version>0.1-SNAPSHOT</version>
<parent>
<groupId>my.com</groupId>
<artifactId>parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<relativePath/>
</parent>
这是我运行“mvn clean site”的文件夹的结构:
./pom.xml (aggregation project)
./projA/pom.xml (Project A)
./projB/pom.xml (Project B)
在执行mvn clean site
以下命令之前,parent-pom 已成功部署到 NEXUS 存储库mvn deploy -DaltDeploymentRepository=snapshots::default::http://MyServer:8081/nexus/content/repositories/snapshots
最后是问题本身:
当我mvn clean site
在成功构建 parent-pom 站点部署后立即运行时。如果我从本地存储库(~/.m2/repository)中删除文件夹(及其内容)“我的”(它包含父 pom),然后尝试构建站点,mvn clean site
我收到开头描述的错误. 实际上 Maven 从 NEXUS 下载 parent-pom。我比较了下载的文件和部署后生成的文件,发现很少有文件丢失,例如“0.1-SNAPSHOT”文件夹附近的 maven-metadata-local.xml。
因此,当我尝试从 Jenkins 运行站点构建作业时,我收到了上述错误,因为父 pom 不是从运行 Jenkins 的机器上部署的。
我怎么能想出这个问题或我做错了什么?
谢谢你。