Skip to main content

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

Hi,

I am testing this approach. I didn't know custom packaging.
I am not sure yet if it will fit my need as I think I may still need in some cases to attach dynamically some plugin executions depending on the project content.

Anyway thank you very much for your quick answer.

Short answer, this is not supported by m2e.
 
Manipulating MavenProject model at runtime breaks some fundamental assumptions m2e makes about projects and something I have no plans to support in m2e. I think custom packaging type is a better way to add new plugin executions to projects without having to explicitly configure <plugin> elements in pom.xml.
 
--
Regards,
Igor
 
 
On Wed, Jun 3, 2015, at 07:53 AM, Francois-Xavier Bonnet wrote:
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?
 
_______________________________________________
m2e-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
 

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users

Back to the top