我有一个包含2个子模块的项目,其中我的主“ pom.xml”尚无代码(尚未部署)到我的本地存储库中,但都未部署
当新用户尝试“ mvn install”以获取子模块时,它表明未找到“ com.zzzzz.main”
-无法解决项目的依赖关系 无法读取com.zzzzz.main ==的人工产物描述符
我的主要pom.xml是:
<groupId>com.zzzzz.main</groupId>
<artifactId>main</artifactId>
<version>1-beta</version>
<packaging>pom</packaging>
...
<modules>
<module>app1</module>
<module>app1-daq</module>
</modules>
我的子模块是:
<parent>
<groupId>com.zzzzz.main</groupId>
<artifactId>main</artifactId>
<version>1-beta</version>
</parent>
<artifactId>app1</artifactId>
<version>1</version>
<name>app1</name>
<packaging>jar</packaging>
日志
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] main ............................................... SUCCESS [ 0.001 s]
[INFO] app1 ............................................... SUCCESS [ 1.414 s]
[INFO] app1-daq ............................................ SUCCESS [ 0.288 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
$ find | grep jar
./app1/target/app1.jar
./app1-daq/target/app1-daq.jar
答案 0 :(得分:1)
您需要使用
<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>org.test</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>child1</module>
<module>child2</module>
</modules></project>
儿童pom
<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>
<artifactId>child1</artifactId>
<parent>
<groupId>org.test</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
</project>