Maven for Eclipse

Maven 2 repository

Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set. Execute the following command:

mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

Restart your Eclipse IDE (if you already have it open) for this change to take effect.

You can also define a new classpath variable inside eclipse: From the menu bar, select Window > Preferences. Select the Java > Build Path > Classpath Variables page.

163542_KAle_1867773.png


Simple Project

If you have a simple java project which is made up of only one module, using eclipse is very simple. To generate the eclipse project files from your POM you execute the following command:

mvn eclipse:eclipse

If you have created or checked out the project with eclipse, you only have to refresh the project in your workspace. Otherwise you have to import the project into your eclipse workspace (From the menu bar, select File >Import >Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because eclipse might come into trouble, especially if you want to use eclipse as the scm client.

http://maven.apache.org/guides/mini/guide-ide-eclipse.html#Maven_2_repository 

PS: 在更新pom后可重新在项目目录下执行

mvn eclipse:eclipse

来重新生成eclipse项目描述文件,然后重启eclipse。



转载于:https://my.oschina.net/cedo/blog/293814

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值