Eclipse (STS) + Maven

丶灬走出姿态 提交于 2019-12-22 05:29:30

问题


I basically have 2 questions:

  • Is there a way to invoke maven console from eclipse? (where I could write eclipse:eclipse, and it started building eclipse project)
  • Where does STS unpack it's maven? I'd like to add that path to env variables, so that I could use it from my windows console.

回答1:


Is there a way to invoke maven console from eclipse? (where I could write eclipse:eclipse, and it started building eclipse project)

You could open a shell inside eclipse , cd into the right directory and run the maven console from there. But, when using M2Eclipse (see next point), you're not supposed to run eclipse:eclipse.

Where does STS unpack it's maven? I'd like to add that path to env variables, so that I could use it from my windows console.

STS bundles M2Eclipse which comes with an embedded version of Maven (so it doesn't "unpack" Maven). But you can Configure M2Eclipse to use an external version. Go to window > Preference > Maven > Installations and Add... your external install:




回答2:


Try the m2eclipse plugin from sonatype and you can eliminate use of 'mvn eclipse:eclipse' altogether. After installing m2eclipse and restarting eclipse, select File->Import->Maven->Existing Maven project. Browse to your maven project and select it. The m2eclipse plugin reads the pom and creates an eclipse project (this is the step that 'mvn eclipse:eclipse' gives). There are other useful features of the m2eclipse plugin including pom editor.

m2eclipse project is moving out of sonatype into the eclipse foundation project page and will be released on the Indigo train.

See this page for more info on m2eclipse: http://m2eclipse.sonatype.org/



来源:https://stackoverflow.com/questions/2341004/eclipse-sts-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!