Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] m2e and maven 3 extensions

Hi,

I developed a maven extension that dynamically binds plugin executions to the build lifecycle of the project.
I just had to override org.apache.maven.AbstractMavenLifecycleParticipant.afterProjectsRead(MavenSession)
and inside this method, I add the plugin executions this way:
Plugin plugin = new Plugin();
plugin.setGroupId("...");
plugin.setArtifactId("...");
plugin.setVersion("...");
PluginExecution pluginExecution = new PluginExecution();
pluginExecution.addGoal("...");
plugin.addExecution(pluginExecution);
session.getCurrentProject().getBuild().addPlugin(plugin);

When I build my project, all the plugin executions run as expected but some of the plugins generate some code and the source folders are not added to the build path by m2e.
This is the case even for plugins that support m2e (like build-helper-maven-plugin) which means that when explicitly declared in the pom.xml, the generated source folder is added to eclipse build path but when added dynamically by my extension it is not.
How can I trigger the addition of a folder to the build path in eclipse without adding explicitly some plugin or lifecycle metadata to my project's pom.xml?
Is there an equivalent of lifecycle-mapping-metadata.xml for maven 3 extensions?


Back to the top