如何使用m2e(m2eclipse)创建JAR? [英] How do I create a JAR with m2e (m2eclipse)?

查看:144
本文介绍了如何使用m2e(m2eclipse)创建JAR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Maven和m2e的新手。令我感到沮丧的是,我不得不问这个问题,但是稀疏的m2e文档和谷歌都让我失望。

I'm new to Maven and m2e. It frustrates me that I have to ask this question, but the sparse m2e documentation and Google are failing me.

如何让m2e建立一个JAR?我知道这应该发生在maven包阶段,但是m2e似乎没有在构建过程中执行此操作,我找不到在Eclipse中显式执行包阶段的方法(也没有任何其他阶段这是默认构建的一部分。)

How do get m2e to build a JAR? I understand that this should happen during the maven package phase, but m2e doesn't seem to do this as part of the build process and I can't find a way to explicitly execute the package phase in Eclipse (nor any other phases that aren't part of the default build).

谢谢。

推荐答案

只要您的POM.xml文件包含以下参数:

As long as you have your POM.xml file with the following parameters:

<modelVersion>[a model number eg 4.0.0]</modelVersion>
<groupId>[a group id eg com.myapp]</groupId>
<artifactId>[a unique artifact id within your packages eg myapp]</artifactId>
<version>[the version number eg 1.0-SNAPSHOT]</version>
<packaging>jar</packaging>
<name>[the name eg myapp]</name>

然后你只需要用目标清理安装来运行maven build 从项目中创建一个jar文件。你可以通过正确克隆项目来运行maven build并运行> maven build ...

then you just need to run maven build with the goals clean install to create a jar file from your project. You can run maven build by right clinking on the project and going to run > maven build ...

jar将在[project dir] / target中创建

The jar will be created in [project dir]/target

这篇关于如何使用m2e(m2eclipse)创建JAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆