在 Eclipse 中运行“mvn clean install”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19793895/
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
Run "mvn clean install" in Eclipse
提问by Josh
Title says it all.
标题说明了一切。
I want to run the console command mvn clean install
on my project in question directlyin Eclipse, not from the command line.
我想直接在 Eclipse 中而不是从命令行mvn clean install
对我有问题的项目运行控制台命令。
It would just be more convenient for me to do this, as I already have the project open in Eclipse. It would save me time if I would not have to navigate to the folder in Windows Explorer.
这样做对我来说会更方便,因为我已经在 Eclipse 中打开了该项目。如果我不必导航到 Windows 资源管理器中的文件夹,这将节省我的时间。
Not a big deal if I can't do this... but can I? And if so, how?
如果我做不到这没什么大不了的……但是我可以吗?如果是这样,如何?
It would be great if I could just right click my project, then click "mvn clean install" from the context menu.
如果我可以右键单击我的项目,然后从上下文菜单中单击“mvn clean install”,那就太好了。
回答by kruiz
I use eclipse STS, so the maven plugin comes pre-installed. However, if you aren't using STS (Springsource Tool Suite), you can still install the m2Eclipse plugin. Here is the link:
我使用 Eclipse STS,因此预装了 Maven 插件。但是,如果您不使用 STS(Springsource Tool Suite),您仍然可以安装 m2Eclipse 插件。链接在这里:
Once you have this installed, you should be able to run all the maven commands. To do so, from the package explorer, you would right click on either the maven project or the pom.xmlin the maven project, highlight Run As, then click Maven Install.
一旦你安装了这个,你应该能够运行所有的 maven 命令。为此,在包资源管理器中,您可以右键单击 maven 项目或 maven 项目中的pom.xml,突出显示Run As,然后单击Maven Install。
Hope this helped.
希望这有帮助。
回答by Vibha
Run a custom maven command in Eclipse as follows:
在 Eclipse 中运行自定义 maven 命令,如下所示:
- Right-click the maven project or pom.xml
- Expand Run As
- Select Maven Build...
- Set Goalsto the command, such as:
clean install -X
- 右键maven项目或者pom.xml
- 展开运行方式
- 选择Maven 构建...
- 为命令设置目标,例如:
clean install -X
Note: Eclipse prefixes the command with mvn
automatically.
注意:Eclipse 会mvn
自动为命令添加前缀。
回答by Roman Konoval
You can create external command Run -> External Tools -> External Tools Configuration...
您可以创建外部命令 Run -> External Tools -> External Tools Configuration...
It will be available under Run -> External Tools and can be run using shortcuts.
它将在运行 -> 外部工具下可用,并且可以使用快捷方式运行。
回答by Maz Standing
Right click on pom.xml, Run As, you should see the list of m2 options if you have Maven installed, you can select Maven Clean from there
右键单击 pom.xml,Run As,如果您安装了 Maven,您应该会看到 m2 选项列表,您可以从那里选择 Maven Clean
回答by Maverick
If you want to open command prompt inside your eclipse, this can be a useful approach to link cmd with eclipse.
如果您想在 eclipse 中打开命令提示符,这可能是将 cmd 与 eclipse 链接的有用方法。
You can follow this link to get the steps in detail with screenshots. How to use cmd prompt inside Eclipse ?
您可以点击此链接通过屏幕截图详细了解步骤。 如何在 Eclipse 中使用 cmd 提示符?
I'm quoting the steps here:
我在这里引用步骤:
Step 1:Setup a new External Configuration Tool
步骤 1:设置新的外部配置工具
In the Eclipse tool go to Run -> External Tools -> External Tools Configurations option.
在 Eclipse 工具中,转到运行 -> 外部工具 -> 外部工具配置选项。
Step 2:Click New Launch Configuration option in Create, manage and run configuration screen
步骤 2:在创建、管理和运行配置屏幕中单击新建启动配置选项
Step 3:New Configuration screen for configuring the command prompt
步骤 3:用于配置命令提示符的新配置屏幕
Step 4:Provide configuration details of the Command Prompt in the Main tab
步骤 4:在 Main 选项卡中提供命令提示符的配置详细信息
Name:Give any name to your configuration (Here it is Command_Prompt)
Location:Location of the CMD.exe in your Windows
Working Directory:Any directory where you want to point the Command prompt
名称:为您的配置指定任何名称(这里是 Command_Prompt)
位置:CMD.exe 在 Windows
工作目录中的位置:您想要指向命令提示符的任何目录
Step 5:Tick the check box Allocate console This will ensure the eclipse console is being used as the command prompt for any input or output.
第 5 步:勾选分配控制台复选框 这将确保 eclipse 控制台被用作任何输入或输出的命令提示符。
Step 6:Click Run and you are there!! You will land up in the C: directory as a working directory
第 6 步:点击运行,你就在那里!!您将进入 C: 目录作为工作目录
回答by Josh
Just found a convenient workaround:
刚刚找到了一个方便的解决方法:
Package Explorer > Context Menu (for specific project) > StartExplorer > Start Shell Here
Package Explorer > Context Menu(对于特定项目)> StartExplorer > Start Shell Here
This opens the cmd line for my project.
这将打开我的项目的 cmd 行。
Unless someone can provide me a better answer, I will accept my own for now.
除非有人能给我一个更好的答案,否则我现在会接受我自己的答案。