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:html

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.java

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.shell


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:apache

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.eclipse

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

PS: 在更新pom後可從新在項目目錄下執行ide

mvn eclipse:eclipse

來從新生成eclipse項目描述文件,而後重啓eclipse。
ui

相關文章
相關標籤/搜索