如何在 Eclipse 中访问(嵌入)Maven 控制台?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7858495/
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
How to get access to (embedded in) Maven console in Eclipse?
提问by marioosh
Is possible to access Maven (embedded) console in Eclipse like in shell (linux shell, windows cmd.exe) to run custom maven commands (mvn archetype:create.... etc) ? I'm using m2e, but can run Maven commands only by GUI.
是否可以像在 shell(linux shell、windows cmd.exe)中一样在 Eclipse 中访问 Maven(嵌入式)控制台来运行自定义 maven 命令(mvn archetype:create.... 等)?我正在使用 m2e,但只能通过 GUI 运行 Maven 命令。
回答by Piotr Nowicki
You can run custom maven commands directly from Eclipse by doing:
您可以通过执行以下操作直接从 Eclipse 运行自定义 Maven 命令:
Run -> Run Configurations... -> Maven Build
You'll need just some Maven plugin for Eclipse like m2e.
你只需要一些 Eclipse 的 Maven 插件,比如 m2e。
回答by kitaev
maybe you can use "external tools" function to do it.
也许您可以使用“外部工具”功能来做到这一点。
see:
看:
- In Eclipse, choose “Run -> External Tools -> External Tools Configurations
- In "Program", click “New Launch Configuration”
- Config your console name, location, working directory
- "run"
- 在 Eclipse 中,选择“运行 -> 外部工具 -> 外部工具配置”
- 在“程序”中,单击“新建启动配置”
- 配置您的控制台名称、位置、工作目录
- “跑”
sorry for no images, because my reputation is below 10.
抱歉没有图片,因为我的声誉低于 10。
回答by Mateusz Chromiński
I highly recommend shell plugin for Eclipse: Wicked shell (http://www.wickedshell.net/)
我强烈推荐 Eclipse 的 shell 插件:Wicked shell (http://www.wickedshell.net/)
回答by Diego
Sadly I don't know about any Eclipse plugin to do that :(
遗憾的是,我不知道有任何 Eclipse 插件可以做到这一点:(
A long time ago (in the Maven 1 era) there was a Maven goal called "console" that allowed you to execute goals in a pre-loaded maven instance. But that feature was discontinued in Maven 2.
很久以前(在 Maven 1 时代)有一个名为“控制台”的 Maven 目标,它允许您在预加载的 Maven 实例中执行目标。但该功能在 Maven 2 中已停止使用。
For new versions of Maven (Maven 3), the folks at Sonatype made a Maven Shell which I think will do what you want: http://shell.sonatype.org/index.html
对于新版本的 Maven (Maven 3),Sonatype 的人制作了一个 Maven Shell,我认为它可以满足您的需求:http: //shell.sonatype.org/index.html