如何引用pom.xml中包含的模块?
在下面引用的<dependency>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
中,如何在此pom中包含模块,以便在其他项目中引用它:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<dependencies>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.3.3</version>
</dependency>
</dependencies>
</project>
的pom.xml
XX = \
[
[
{
'the_geom': col['the_geom'],
'values': list(zip(*[col[key] for key in col.keys() if key != 'the_geom']))
}
for col in row]
for row in X]
答案 0 :(得分:0)
我认为您可以做的最好的事情就是将子模块放在父POM的dependencyManagement部分中,如下所示:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>module1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>module2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>module3</artifactId>
<version>${project.version}</version>
</dependency>
<dependencies>
</dependencyManagement>
然后,您可以使用他们需要的任何依赖项配置每个子模块,而不必担心正确的版本号。
<!-- module2's dependencies -->
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>module1</artifactId>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>module3</artifactId>
</dependency>
<dependencies>
如果您将所有子模块声明为父POM的依赖关系,那么您最终会得到循环依赖关系。例如:
[parent] -> [module1] -> [parent]
Maven并不喜欢这样。