将jar库添加到jar文件中 [英] adding jar libraries into jar file
本文介绍了将jar库添加到jar文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一个maven项目。在一个想法中编译和运行我的项目时一切都很好,但每当我创建jar文件时,web / lib /中的外部jar文件都无法复制到jar文件中。为什么会这样?我可以将我的所有文件都插入到jar文件中吗?
I am doing a maven project. Everything is fine when compiling and running my project in an idea, but whenever I create jar file, my external jar files in web/lib/ cannot be copied into the jar file. Why this occurs ? Can I insert my all files into the jar file ?
推荐答案
是的,我找到了解决方案。
Yes I found solution.
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<finalName>HelloWorld</finalName>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.gui.launcher.LauncherMain</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- append to the packaging phase. -->
<goals>
<goal>single</goal>
<!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
这篇关于将jar库添加到jar文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文