我有一个父母maven project
和two child modules
那个父母。其中一个子模块具有packaging type of jar
. 这个 jar 将在另一个子模块中使用packaging type of war.
第一个孩子的 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>
<parent>
<groupId>com.zurel.myParent</groupId>
<artifactId>myParent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>myFirstChild</artifactId>
<packaging>jar</packaging>
</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>
<parent>
<groupId>com.zurel.myParent</groupId>
<artifactId>myParent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>myFirst</artifactId>
<packaging>war</packaging>
<dependencies>
<!--other dependencies -->
<dependency>
<groupId>com.zurel.myParent</groupId>
<artifactId>myFirstChild</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
当我尝试在第二个 maven 模块中运行 package 命令时,出现以下错误:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myFirst 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.zurel.myParent:myFirstChild:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.353s
[INFO] Finished at: Thu Jun 19 16:20:58 NPT 2014
[INFO] Final Memory: 5M/100M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myFirst: Could not resolve dependencies for project com.zurel.myParent:myFirst:war:0.0.1-SNAPSHOT: Could not find artifact com.zurel.myParent:myFirstChild:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException