【发布时间】:2014-12-10 16:27:08
【问题描述】:
首先我是 maven 新手,如果这个问题太简单了,我很抱歉:)
我有主模块“main” 和子模块: a , b , c , ...
我想要的是与子模块 b 共享子模块 a 中的一些数据。
父 pom 看起来像: 4.0.0
<groupId>Parent</groupId>
<artifactId>Parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>a</module>
<module>b</module>
<module>c</module>
</modules>
</project>
我要分享的孩子长这样:
<parent>
<artifactId>Parent</artifactId>
<groupId>Parent</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>a</artifactId>
</project>
“消费者”孩子看起来像:
<parent>
<artifactId>Parent</artifactId>
<groupId>Parent</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>b</artifactId>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>a</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
我确实看到 jar 文件被添加到“外部库”(我正在使用 Intellij) 但是jar只包含没有代码的META-INF文件夹(可以吗?)
故事结束,我不能在 ChildB 类中使用 Class ChildA ... 任何帮助都应该受到欢迎!
【问题讨论】:
标签: java maven multi-module