rws*_*wst 3 java pom.xml maven
我刚开始转向 Maven,所以目前没有 pom.xml。我的项目仅依赖于另一个不属于我的项目的模块子集。他们在其分发的 pom 中列出了模块列表。如何在 pom.xml 中声明对特定 jar(可能包含在下载的 jar 中)的依赖关系?
如果您的其他项目被组织成具有自己的子 Maven 模块pom.xml,那么这些子 Maven 模块的 , , 节点将像您的主项目一样包含<groupId>在内<artifactId>。<version>
例如
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>
Run Code Online (Sandbox Code Playgroud)
在项目 2 中,如果您只需要common、util和domain域模块,则该项目的 pom.xml 将包含以下依赖项:
<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>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!