范围“编译”是我需要的。我对 maven 目标包、程序集等的范围编译、运行时、测试等感到困惑。
项目 A 的 Pom:
<parent>
<groupId>net.company</groupId>
<artifactId>superpom</artifactId>
<version>1.0.2</version>
</parent>
<groupId>net.company.projectA</groupId>
<artifactId>projectA</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>compile</scope>
</dependency>
</dependencies>
项目 B 的 Pom:
<parent>
<groupId>net.company</groupId>
<artifactId>superpom</artifactId>
<version>1.0.2</version>
</parent>
<groupId>net.company.projectB</groupId>
<artifactId>projectB</artifactId>
<version>1.1.2-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>net.company.projectA</groupId>
<artifactId>projectA</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>