Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Running multiple MojoExecutions without resetting MavenProject.properties

Hi,

My issue is the following:

I would like to execute multiple MojoExecutions in the way that one of them sets a mavenProject property and the other reads it.

There are several examples to this with existing Mojos. E.g.:

 - maven-scr-plugin sets a maven project property while maven-bundle-plugin reads it
 - buildnumber-maven-plugin sets maven project property that is used during manifest generation by other mojo

The issue is that there is no function where I can run multiple mojoExecutions and they use the share the same mavenProject. Every call goes through the following function:

    org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenSession session, MojoExecution execution, IProgressMonitor monitor)

This persists the project state and then restores it. So multiple mojos cannot share the same project properties.

Do you know a workaround? I can imagine only one with the current API but it is pretty ugly:

 - I develop a CallbackMojo. This mojo checks if there is a Runnable provided via MavenExecutionRequest data and if there is, it calls it.
 - In my M2E based code, I execute this mojo and pass the calling of the real execution plan via a lambda _expression_.

It would be nice if there was a function to execute multiple mojo-s in a row where mavenproject state is not persisted and restored between the mojo executions.

Kind regards,
Zsoldos Balázs


Back to the top