从 Eclipse 运行的 Maven 目标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10970974/
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 21:07:14  来源:igfitidea点击:

Maven goal running from eclipse

eclipsemavenm2eclipse

提问by Sara

When I run mvn compilefrom command line, it builds using pom.xml. But when I try to run it within Eclipse (by using m2eclipse plugin), when I right click on the pom.xmland run as maven build, it asks for a goal. I am new to Maven and want to run it through Eclipse. So why doesn't it ask for anything when running from command line? Is there a default goal?

当我从命令行运行时mvn compile,它使用pom.xml. 但是当我尝试在 Eclipse 中运行它(通过使用 m2eclipse 插件)时,当我右键单击它pom.xml并作为 maven build 运行时,它会要求一个目标。我是 Maven 的新手,想通过 Eclipse 运行它。那么为什么从命令行运行时它不要求任何东西呢?有默认目标吗?

采纳答案by Dave Newton

Yes, there is a default goal, but what it is depends on the project, and can be explicitly defined.

是的,有一个默认目标,但它是什么取决于项目,并且可以明确定义。

See the BaseBuild Element Set(the default goal is install) as well as the rest of that page for further information. IIRC you can define a default goal for m2eclipse, although I haven't used it in some time.

有关更多信息,请参阅BaseBuild 元素集(默认目标是install)以及该页面的其余部分。IIRC 你可以为 m2eclipse 定义一个默认目标,虽然我已经有一段时间没有使用它了。

There's also a setting to define a goal to be run when a source directory is updated:

还有一个设置来定义更新源目录时要运行的目标:

http://www.sonatype.com/books/m2eclipse-book/reference/preferences.html

http://www.sonatype.com/books/m2eclipse-book/reference/preferences.html