【发布时间】:2018-08-07 03:10:10
【问题描述】:
现在我有一个 Maven 项目,这是我的项目结构:
| sound(parent)
| -- sound-service (sub-module)
| -- sound-start (sub-module)
在sound 的pom 中。我有以下内容:
<modules>
<module>sound-service</module>
<module>sound-start</module>
</modules>
依次点击clean-compile-package后,IDEA IntelliJ帮我为每个子模块创建了两个JAR包。但我想要的是一个包含所有依赖项和 JAR 库的单个 JAR 文件。我还在父根的 pom 文件中添加了以下 maven 插件,但我仍然无法获得一个包含整个内容的 JAR。
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.yct.Application</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我错过了什么吗?我是否还需要在sound的pom中添加一些其他依赖项?
【问题讨论】:
-
您正在寻找“胖罐”解决方案 - 我认为,并不是真正玩过“模块”