在导入到 Eclipse 期间设置 Maven 目标

Set maven goal during import to Eclipse

在我的 Java 项目中,我通过 idlj-maven-plugin 从 IDL 文件生成了很多源文件。它运行良好——它在编译之前生成文件,例如,我在 Eclipse 中编译目标 运行。但是,我想知道当有人在 Eclipse 中导入我的项目时是否可以生成源文件。我的意思是,我想在以下场景中实现最后一步:

在M2Eclipse的描述中有一个声明,建议可以在导入项目时设置目标。我一直在寻找有关如何配置 M2Eclipse 来执行此操作的信息,但没有成功。

我自己没有使用过 idlj-maven-plugin,但我们调整了常规 "ignore-eclipse-mapping"-插件配置,用于我们为 in-house 需求开发的另一个自定义插件:

<pluginManagement>
  <plugins>
    <plugin>
     <groupId>org.eclipse.m2e</groupId>
     <artifactId>lifecycle-mapping</artifactId>
     <version>1.0.0</version>
     <configuration>
       <lifecycleMappingMetadata>
         <pluginExecutions>
           <pluginExecution>
             <pluginExecutionFilter>
               <groupId>OUR_PLUGIN_GROUP_ID</groupId>
               <artifactId>OUR_PLUGIN_ARTIFACT_ID</artifactId>
               <versionRange>[2.3,)</versionRange> <!-- Or whatever -->
               <goals>
                 <goal>generate</goal> <!-- Or whatever idlj needs -->
               </goals>
             </pluginExecutionFilter>
             <action>
               <!-- this is what decides if the plugin should run or not -->
               <!-- Most often, you will have an <ignore/> tag instead. -->
               <execute>
                 <runOnIncremental>false</runOnIncremental>
               </execute >
             </action>
           </pluginExecution>
         </pluginExecutions>
       </lifecycleMappingMetadata>
     </configuration>
    </plugin>
  </plugins>
</pluginManagement>

我想 this link 有一些关于它的信息。