我正在尝试构建一个包含多个子模块和一个“打包”子模块的父项目 - 完全按照https://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-中的描述二进制包含-simple.html
子模块在本地存储库中构建并安装,但是当“打包”子模块构建时,maven 抱怨无法找到其他子模块之一 - 而是尝试从中央下载它Maven Nexus(当然找不到它)。
有人知道我可能会错过什么吗?
包/pom.xml:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>group</groupId>
<artifactId>parent</artifactId>
<version>CURRENT</version>
</parent>
<groupId>group</groupId>
<artifactId>package</artifactId>
<version>CURRENT</version>
<packaging>pom</packaging>
<name>package module</name>
<properties>
<project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
<project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>common</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>metaserviceclient</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>hierarchyclient</artifactId>
<version>CURRENT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>package.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
包/package.xml
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bin</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>group:*</include>
</includes>
<binaries>
<includeDependencies>true</includeDependencies>
<unpack>false</unpack>
<outputDirectory>opt/lib</outputDirectory>
<outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
层次客户端/pom.xml
<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>group</groupId>
<artifactId>hierarchyclient</artifactId>
<name>Hierarchy client</name>
<parent>
<groupId>group</groupId>
<artifactId>parent</artifactId>
<version>CURRENT</version>
</parent>
<dependencies>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>common</artifactId>
<version>CURRENT</version>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
pom.xml
<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>parent</artifactId>
<groupId>group</groupId>
<version>CURRENT</version>
<packaging>pom</packaging>
<modules>
<module>hierarchyclient</module>
<module>common</module>
<module>metaserviceclient</module>
<module>package</module> <!-- responsible for package preparation -->
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<compilerVersion>1.8</compilerVersion>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
<project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
行家输出:
[15:27:28][INFO] --- maven-install-plugin:2.3.1:install (default-install) @ hierarchyclient ---
[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/target/hierarchyclient-CURRENT.jar to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.jar
[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/pom.xml to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
然后
[15:27:31][group:package] Downloading: http://$REPOSITORY/nexus/content/groups/public/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
[15:27:31][group:package] Downloading: http://repo.maven.apache.org/maven2/coba/frisk/legacy/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom
[15:27:31][group:package] Failed to execute goal on project package: Could not resolve dependencies for project group:package:pom:CURRENT: Failed to collect dependencies for [group:common:jar:CURRENT (compile), group:metaserviceclient:jar:CURRENT (compile), group:hierarchyclient:jar:CURRENT (compile), junit:junit:jar:4.12 (test)]