I'm trying to set up a multi-module Maven project, and inter-module dependencies seem to be installing incorrectly.
I have:
<modules> <module>commons</module> <module>storage</module> </modules>
in the parent POM (which has a packing type pom), and then in the commons/ and storage/ subdirectories that define the POM JAR with the same name.
Storage depends on the stock.
In the main (main) directory, I run mvn dependency:tree and see:
[INFO] Building system [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] domain:system:pom:1.0-SNAPSHOT [INFO] \- junit:junit:jar:3.8.1:test [INFO] ------------------------------------------------------------------------ [INFO] Building commons [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] ...correct tree... [INFO] ------------------------------------------------------------------------ [INFO] Building storage [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ Downloading: http://my.repo/artifactory/repo/domain/commons/1.0-SNAPSHOT/commons-1.0-SNAPSHOT.jar [INFO] Unable to find resource 'domain:commons:jar:1.0-SNAPSHOT' in repository my.repo (http://my.repo/artifactory/repo) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) domain:commons:jar:1.0-SNAPSHOT
Why does the dependency on the โcommon commonsโ fail, even if the reactor clearly saw it, because it successfully processes its dependency tree? It definitely shouldn't go online to find it like this right there ...
Storage pom:
<?xml version="1.0" encoding="UTF-8"?> <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> <packaging>jar</packaging> <parent> <artifactId>system</artifactId> <groupId>domain</groupId> <version>1.0-SNAPSHOT</version> </parent> <groupId>domain</groupId> <artifactId>storage</artifactId> <name>storage</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>domain</groupId> <artifactId>commons</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
Thanks for any suggestions!
(Edit)
To clarify what I'm looking for here is this: I don't want to install module X to build module Y, which depends on X, given that both modules are links from the same parent POM. For me it is intuitively clear that if there are two things in one source tree, I do not need to install intermediate products to continue the assembly. Hope my thinking makes sense here ...
java maven maven-2 dependencies
Steven Schlansker Nov 04 '09 at 23:47 2009-11-04 23:47
source share