简体   繁体   English

如何构建还包含源文件的可执行文件uber-jar?

[英]How to build an executable uber-jar also containing source files?

have a little java-Project in Eclipse with maven that I would like to turn into a jar with the following specifications: 在Eclipse中有一个带有maven的小java项目,我想将其变成具有以下规范的jar:

  • executable 可执行
  • containing all dependencies 包含所有依赖项
  • containing all source files (*.java) besides the compiled *.class files 除已编译的* .class文件外,还包含所有源文件(* .java)

So far, I've found shade and source as plugin which each serve two of my needs but not all three. 到目前为止,我已经找到了shade和source作为插件,它们分别满足我的两个需求,但不能同时满足三个需求。 Does anyone know how to tweak maven into doing all of the above? 有谁知道如何调整行家做上述所有事情?

I'm aware of this being an usual request but the goal is to have the source code with the class files in case something goes wrong and nobody remembers which project this came from. 我知道这是一个通常的请求,但是目标是将源代码和类文件一起使用,以防万一出问题并且没有人记得它来自哪个项目。

Including the sources has already been answered here 包括来源已在此处得到解答

Regarding an executable jar with all the libraries included in a single file, what you're looking for is a fat jar. 对于单个文件中包含所有库的可执行jar,您要查找的是胖jar。 You can use this plugin for eclipse or Maven to build your jar. 您可以将此插件用于Eclipse或Maven来构建您的jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM