Eclipse中的maven Java项目不会生成jar文件。

时间:2023-01-25 14:19:23

If I use command line command like "mvn compile" and "mvn install", I see a jar file under target directory.

如果我使用命令行命令,如“mvn编译”和“mvn安装”,我将看到目标目录下的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文件,但是只在目标目录下编译类目录,但是它们是空的。对这个问题有什么见解吗?

1 个解决方案

#1


30  

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不会建一个罐子。(在使用某些连接器来开发OSGi包时,这是一个例外,但我认为您不是。)

To build a jar:

构建一个jar:

  • Right-click on the project folder in the 'Package Explorer' view;
  • 右键单击“Package Explorer”视图中的项目文件夹;
  • Select "Run As"
  • 选择“运行”
  • Select "Maven install"
  • 选择“Maven安装”

#1


30  

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不会建一个罐子。(在使用某些连接器来开发OSGi包时,这是一个例外,但我认为您不是。)

To build a jar:

构建一个jar:

  • Right-click on the project folder in the 'Package Explorer' view;
  • 右键单击“Package Explorer”视图中的项目文件夹;
  • Select "Run As"
  • 选择“运行”
  • Select "Maven install"
  • 选择“Maven安装”