Eclipse (STS) + Maven

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2341004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:13:55  来源:igfitidea点击:

Eclipse (STS) + Maven

eclipsemaven-2pluginsconsolests-springsourcetoolsuite

提问by folone

I basically have 2 questions:

我基本上有2个问题:

  • Is there a way to invoke maven console from eclipse? (where I could write eclipse:eclipse, and it started building eclipse project)
  • Where does STSunpack it's maven? I'd like to add that path to env variables, so that I could use it from my windows console.
  • 有没有办法从 Eclipse 调用 Maven 控制台?(我可以写的地方eclipse:eclipse,它开始构建 eclipse 项目)
  • STS在哪里解压它的maven?我想将该路径添加到 env 变量,以便我可以从我的 Windows 控制台使用它。

回答by Pascal Thivent

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

有没有办法从 Eclipse 调用 Maven 控制台?(我可以在这里写 eclipse:eclipse,然后它开始构建 eclipse 项目)

You could open a shellinside 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.

您可以在 eclipse 中打开一个 shell, cd 进入正确的目录并从那里运行 maven 控制台。但是,当使用 M2Eclipse(见下一点)时,你不应该运行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在哪里解压它的maven?我想将该路径添加到 env 变量,以便我可以从我的 Windows 控制台使用它。

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 > Installationsand Add...your external install:

STS 捆绑了带有嵌入式 Maven 版本的 M2Eclipse(因此它不会“解压”Maven)。但是您可以配置 M2Eclipse 以使用外部版本。转到window > Preference > Maven > Installationsand Add...你的外部安装:

alt text

替代文字

回答by John

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.

尝试来自 sonatype 的 m2eclipse 插件,您可以完全避免使用 'mvn eclipse:eclipse'。安装m2eclipse并重启eclipse后,选择File->Import->Maven->Existing Maven project。浏览到您的 Maven 项目并选择它。m2eclipse 插件读取 pom 并创建一个 eclipse 项目(这是 'mvn eclipse:eclipse' 给出的步骤)。m2eclipse 插件还有其他有用的功能,包括 pom 编辑器。

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

m2eclipse 项目正在从 sonatype 移到 eclipse 基金会项目页面,并将在 Indigo 列车上发布。

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

有关 m2eclipse 的更多信息,请参阅此页面:http: //m2eclipse.sonatype.org/