我在 Eclipse 中的 maven Java 项目没有生成 jar 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12993504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
My maven Java project in Eclipse doesn't generate jar file
提问by kee
If I use command line command like "mvn compile" and "mvn install", I see a jar file under target directory.
如果我使用像“mvn compile”和“mvn install”这样的命令行命令,我会在目标目录下看到一个jar文件。
But if I build the same project from Eclipse using m2e plugin, I don't see a jar file but only compiled class directories under target directory but they are empty. Any insight on this problem?
但是如果我使用 m2e 插件从 Eclipse 构建相同的项目,我看不到 jar 文件,而只看到目标目录下的编译类目录,但它们是空的。关于这个问题的任何见解?
回答by Martin Ellis
m2e won't build a jar unless you ask it to. (An exception to that is when you're using it with certain connectors to develop OSGi bundles, but I assume you aren't.)
除非您要求,否则 m2e 不会构建 jar。(一个例外是当您将它与某些连接器一起使用来开发 OSGi 包时,但我认为您不是。)
To build a jar:
要构建一个罐子:
- Right-click on the project folder in the 'Package Explorer' view;
- Select "Run As"
- Select "Maven install"
- 在“包资源管理器”视图中右键单击项目文件夹;
- 选择“运行方式”
- 选择“Maven 安装”