我正在尝试将具有以下结构的 Multi-Module maven 项目部署到 Nexus 服务器(具有 p2 支持和配置为快照的目标存储库和正确的 settings.xml 凭据):
- 父项目(空,只有 pom 定义)
- 模块项目 A
- 模块项目 B
mvn install 产生了令人满意的构建,问题是当我尝试部署 PARENT PROJECT 时,它显示以下错误:
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ PARENT PROJECT ---
[INFO] Installing C:\PATH-TO-PARENT-PROJECT\pom.xml to C:\PATH-TO LOCAL-REPO\PATH-TO-PARENT-PROJECT\1.0.0-SNAPSHOT\PARENT-PROJECT-1.0.0-SNAPSHOT.pom
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project PARENT PROJECT: Failed to deploy artifacts: Could not find artifact PARENT PROJECT:pom:1.0.0-20131022.102942-1 in deployment-server (http://DEPLOYMENT-SRV/nexus/content/repositories/snapshots) -> [Help 1]
我可以部署每个子模块独立运行 mvn deploy 在它们上,但是当我在父项目上运行它时,它给了我这个错误。父pom如下:
<?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>ID</groupId>
<artifactId>PARENT-PROJECT</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>0.18.1</tycho-version>
</properties>
<modules>
<module>MODULE PROJECT A</module>
<module>MODULE PROJECT B</module>
</modules>
<repositories>
<repository>
<id>eclipse-juno</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/juno</url>
</repository>
<repository>
<id>snapshots</id>
<url>http://DEPLOYMENT-SRV/nexus/content/repositories/snapshots/.meta/p2</url>
<layout>p2</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>${build.os}</os>
<ws>${build.ws}</ws>
<arch>${build.arch}</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/assemble/bin.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<configuration>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>deployment</id>
<url>http://DEPLOYMENT-SRV/nexus/content/repositories/snapshots</url>
<layout>p2</layout>
</snapshotRepository>
</distributionManagement>
</project>
谢谢!