简体   繁体   English

Eclipse启动配置:解决项目中的活动概要文件

[英]Eclipse launch configuration: resolve active profiles in project

I have several .launch files for Eclipse (I'm using Eclipse Oxygen), here is an example 我有几个用于Eclipse的.launch文件(我正在使用Eclipse Oxygen),这是一个示例

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
    <booleanAttribute key="M2_DEBUG_OUTPUT" value="false" />
    <stringAttribute key="M2_GOALS" value="clean com.google.cloud.tools:appengine-maven-plugin:deploy" />
    <booleanAttribute key="M2_NON_RECURSIVE" value="false" />
    <booleanAttribute key="M2_OFFLINE" value="false" />
    <stringAttribute key="M2_PROFILES" value="" />
    <listAttribute key="M2_PROPERTIES" />
    <stringAttribute key="M2_RUNTIME" value="EMBEDDED" />
    <booleanAttribute key="M2_SKIP_TESTS" value="true" />
    <intAttribute key="M2_THREADS" value="1" />
    <booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false" />
    <stringAttribute key="M2_USER_SETTINGS" value="" />
    <booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false" />
    <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}" />
</launchConfiguration>

Note that I'm using ${project_loc} variable in order to make it usable for any project. 请注意,我正在使用${project_loc}变量,以使其可用于任何项目。

I'm using this kind of files because I can share those with my team. 我正在使用这种文件,因为我可以与团队共享这些文件。 Also the most used Maven Build configurations are ready to go w/o configuring every time a new launch profile. 而且,每次使用新的启动配置文件时,最常用的Maven Build配置也可以不进行配置。

The problem I'm facing is related to the profile value 我面临的问题与配置文件值有关

<stringAttribute key="M2_PROFILES" value="" />

With the CTRL+ALT+P shortcut on a project, I can select the proper profile to load ( Select Maven Profiles... function). 使用项目上的CTRL+ALT+P快捷键,我可以选择要加载的适当配置文件(“ Select Maven Profiles...功能)。 I'm using different profile to discern the environment for the deploy (development, stage o production). 我正在使用不同的配置文件来识别部署(开发,生产阶段)的环境。

I'm trying to "inject" the profile I enabled for the project into the generic launch profile configuration, something like the ${project_loc} variable but related to the current Maven profile. 我试图将为项目启用的配置文件“注入”到通用启动配置文件配置中,类似于${project_loc}变量,但与当前的Maven配置文件相关。

If this cannot be made I need to create a launch profile for each environment, which means 3 files per every goal to launch. 如果无法做到这一点,则需要为每个环境创建一个启动配置文件,这意味着每个要启动的目标需要3个文件。

Is there a way to use/create an Eclipse variable that can be resolved with the Maven profile I activated on the project? 有没有一种方法可以使用/创建一个Eclipse变量,该变量可以通过在项目上激活的Maven概要文件进行解析?

Something like 就像是

<stringAttribute key="M2_PROFILES" value="${maven.profile.id}" />

您需要创建一个Eclipse插件(或参与Eclipse m2e项目),以便使用专用扩展点定义变量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在带有m2e的Eclipse中,“选择活动配置文件”和“运行配置:配置文件”有什么区别? - What is the difference between “Select Active Profiles” and “Run Configuration: profiles” in Eclipse with m2e? Eclipse -- Testng 引用不存在的项目 XXX,启动配置 - Eclipse -- Testng references non-existing project XXX, launch configuration Eclipse配置,以使用Google Web Toolkit启动Maven项目 - Eclipse configuration to launch a Maven project with Google Web Toolkit 基于多个活动配置文件的Spring配置 - Spring configuration based on multiple active profiles Eclipse启动现有的启动配置 - Eclipse launch existing launch-configuration "无法解析值“classpath:\/ldap-${spring.profiles.active}.properties”中的占位符“spring.profiles.active”" - Could not resolve placeholder 'spring.profiles.active' in value "classpath:/ldap-${spring.profiles.active}.properties" Eclipse Kepler项目配置 - Eclipse Kepler Project Configuration 我如何将 Eclipse 启动组配置与项目一起导入另一个工作区 - How can i import a Eclipse launch-group configuration into another workspace along with project Eclipse启动配置出错:GrammaticalStructure.1引用非现有项目开始 - Error in Eclipse launch configuration: GrammaticalStructure.1 references non-existing project begins 将 Spring 启动项目导出到可运行的 jar 文件时缺少 Eclipse 启动配置 - Eclipse launch configuration is missing when exporting a Spring boot project to a runnable jar file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM