如何将配置文件添加到 Eclipse 中的默认 Maven 目标?

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

How to add profiles to default maven goals in Eclipse?

eclipsemavenm2eclipse

提问by jedatu

I am using Maven inside Eclipse to build and deploy code.

我在 Eclipse 中使用 Maven 来构建和部署代码。

When choosing {Context Menu} > Run As, several Maven goals appear as follows:

选择时{Context Menu} > Run As,会出现几个Maven目标如下:

Eclipse Run As Context Menu

Eclipse 运行方式上下文菜单

I understand that if I want to create a custom build configuration, I would click "Run Configurations..." to create a custom configuration.

我知道如果我想创建自定义构建配置,我会单击“运行配置...”来创建自定义配置。

However, there seems to be no way to modify the configurations that appear conveniently on the menu. For instance, you can't add a profile to #7 "Maven install". The result is tedious, because you have click about 5 times to launch the build.

但是,似乎没有办法修改菜单上方便出现的配置。例如,您不能将配置文件添加到 #7“Maven 安装”。结果很乏味,因为您单击了大约 5 次以启动构建。

Is there any way to add profiles or additional goals to #7 "Maven install" build or add custom configurations to the context menu?

有什么方法可以将配置文件或其他目标添加到 #7 “Maven install” 构建或将自定义配置添加到上下文菜单中?

Is there a way to launch a specific build configuration with a keyboard combination?

有没有办法使用键盘组合启动特定的构建配置?

I have tried IntelliJ and NetBeans and the Maven integration in all of them seems confusing trying to differentiate between basic Maven goals and the more realistic custom combination of goals and profiles.

我已经尝试过 IntelliJ 和 NetBeans,并且它们中的 Maven 集成在尝试区分基本 Maven 目标和更现实的目标和配置文件的自定义组合时似乎令人困惑。

回答by Morfic

  1. Select "Maven build..." from the menu and create the configuration
  1. 从菜单中选择“Maven build...”并创建配置

Create configuration

创建配置

  1. Add it to the favourites for later use / launch the build
  1. 将其添加到收藏夹供以后使用/启动构建

Add it to favourites for later use

将其添加到收藏夹以备后用