Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Output folders not refreshed between build participants

This is a bug but will likely be hard to fix. I am not even sure it is
possible to fix. What may work, is to create new BuildContext for each
mojo executed from within MavenBuilder during incremental build. This
build context should original resource delta that triggered the build
and any changes done by mojos already executed during this build.

And to be clear, I have no immediate plans to look at this unless
somebody provides a quality patch.

--
Regards,
Igor

On 12-09-14 4:40 AM, Andrius Velykis wrote:
Hello,

I have an issue with m2e when chaining plugins in Maven, i.e. when the
output folder of first plugin is used by second plugin as an input
folder. A small example below:

1. my first plugin generates JFlex source files out of XML using XSLT
and puts everything into /target/generated-sources/src-jflex. This is
bound to 'generate-sources' phase.
2. then JFlex plugin uses the /target/generated-sources/src-jflex
folder as input (lexDefinitions), and generates Java source files to
/target/generated-sources/jflex. This is bound to 'process-sources'
phase to ensure that the results of step 1 are visible to JFlex plugin.

This works correctly from the command line, using 'mvn clean install'.

Now I try using it with m2e. I have created a connector for my plugin
(step 1), which uses `buildContext.refresh(src-jflex-dir)` to refresh
the generated JFlex sources.

However, when I run it in m2e, JFlex plugin's connector cannot find the
generated source directory in the Workspace and therefore does not execute.

After a little debugging, I see that in
org.eclipse.m2e.core.internal.builder.MavenBuilderImpl#build(), all
build participants are launched in the same loop, and resource refresh
is performed only after all participants execute. This looks too late in
my case, because I need the output folder from step1 to be refreshed
before step2 participant is executed.

Am I using it wrong? Is there any way to achieve that the folder is
refreshed before JFlex plugin starts the build? Or some option to get
m2e respect different build phases to achieve the order?

Thank you,
~Andrius Velykis


_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top