m2e: Generated code with exec-maven-plugin

后端 未结 2 1172
陌清茗
陌清茗 2021-02-01 05:54

I have been using m2eclipse for 2 years or so and have now switched to m2e.

Unfortunately, this has broken some functionality for me.

In many projects, I have ge

相关标签:
2条回答
  • 2021-02-01 06:26

    In Eclipse you can define which life-cycle step will be run during an import which is by default empty. You can simply change this to process-resources or do a simply Maven -> Update Project Configuration. In the configuration (Windows -> Preferences -> Maven) you can change the default behaviour to simplify your live.

    0 讨论(0)
  • 2021-02-01 06:33

    You have to tell M2E that it's okay to run your code generator as part of the Eclipse build:

    <project>
      <build>
         [...]
         <pluginManagement>
          <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence 
              on the Maven build itself. -->
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <versionRange>[,)</versionRange>
                        <goals>
                          <goal>java</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <execute/>
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </project>
    

    Notes:

    1. It's important to put this configuration in the pluginManagement section, not directly under plugins.
    2. This will cause M2E to perform all java executions specified in your POM as part of every Eclipse build. This means they will run often and be a big nuisance if they are slow. I'm not sure how you would get M2E to run some of them and skip others. You'd probably have to place the unwanted executions in profiles.
    0 讨论(0)
提交回复
热议问题