In my Java project I generate a lot of source files from IDL files by idlj-maven-plugin. It works well - it generates files before compilation when, for example, I run compile goal in Eclipse. However, I wonder if it possible to generate source files when someone imports my project in Eclipse. I mean, I would like to achieve the last step in the following scenario:
In the M2Eclipse description there is a statement that suggest that it is possible to set goals when projects are imported. I was looking for information about how to configure M2Eclipse to do that but with no luck.
I haven't used the idlj-maven-plugin
myself, but we tweaked the regular "ignore-eclipse-mapping"-plugin configuration for another custom plugin we developed for our in-house needs:
<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>
I think this link has some information about it.