Reputation: 2675
I'm at the beginning to move to Maven so I have no pom.xml at the moment. My project depends on only a subset of modules of another project which is not mine. They have the list of modules listed in their pom which is distributed. How do I state the dependency on the specific jars (which presumably are contained in the downloaded jar) in my pom.xml?
Upvotes: 3
Views: 9479
Reputation: 24124
If your other project is organized into sub-maven-modules with their own pom.xml
, then the <groupId>
, <artifactId>
, <version>
nodes of these sub-maven-modules will be included as in your main project.
E.g.
project 1
|- common
|- pom.xml
<groupId>com.project1</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
|- util
|- pom.xml
<groupId>com.project1</groupId>
<artifactId>util</artifactId>
<version>1.0</version>
|- domain
|- pom.xml
<groupId>com.project1</groupId>
<artifactId>domain</artifactId>
<version>1.0</version>
|- service
|- pom.xml
<groupId>com.project1</groupId>
<artifactId>service</artifactId>
<version>1.0</version>
|- webapps
|- pom.xml
<groupId>com.project1</groupId>
<artifactId>webapps</artifactId>
<version>1.0</version>
In project 2, if you just want only the common
, util
and domain
and domain modules, then pom.xml for this project would contain the following dependencies:
<dependencies>
...
<dependency>
<groupId>com.project1</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.project1</groupId>
<artifactId>util</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.project1</groupId>
<artifactId>domain</artifactId>
<version>1.0</version>
</dependency>
...
</dependencies>
Hope this helps!
Upvotes: 6