0

I'm using the Tycho eclipserun plugin to generate Java source code for an EMF model during build (as opposed to having the sources checked in). Configuring the plugin to run as part of the maven build works fine, but I would also like to configure m2e so that the same goal is executed when building from inside Eclipse. So, I imagined that could get away with just specifying <execute/> instead of <ignore/> in the lifecycle mapping metadata, like so:

<pluginExecution>
    <pluginExecutionFilter>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-eclipserun-plugin</artifactId>
        <versionRange>[0.21.0,)</versionRange>
        <goals>
            <goal>eclipse-run</goal>
        </goals>
    </pluginExecutionFilter>
    <action>
        <execute />
    </action>
</pluginExecution>

But then m2e complains saying

Execution default of goal org.eclipse.tycho.extras:tycho-eclipserun-plugin:0.21.0:eclipse-run failed: java.lang.IllegalStateException: Cannot run multiple Equinox instances in one build. Consider configuring the Tycho build extension, so that all mojos using Tycho functionality share the same Equinox runtime. (org.eclipse.tycho.extras:tycho-eclipserun-plugin:0.21.0:eclipse-run:default:generate-sources)

Ok, so m2e cannot run a nested Equinox instance in the same build, which kind of make sense.

Is there a solution for this? One solution I could imagine would be to execute a standalone Eclipse, but I really like the way the eclipserun plugin allows be to do that just by specifying a remote p2 repo and a bunch of features to include, instead of having to set up a standalone Eclipse more or less manually.

JesperE
  • 63,317
  • 21
  • 138
  • 197

1 Answers1

0

If you are already running in Eclipse, you could execute your EMF generation steps in that runtime directly. So you'd need to configure a builder which does the same steps as the tycho-eclipserun-plugin.

In general, for the case where some build step needs to be executed in Eclipse, but in a different way than in Maven, m2e has the concept of configurators: A configurator could tell m2e what to do when it encounters a certain build plug-in. So in case of the tycho-eclipserun-plugin, the configurator could let the goal run in a forked process instead of in-process. However, I'm not aware of such a m2e configurator, and it remains to decide whether it is really a good idea to fork processes as part of the incremental Eclipse build.

oberlies
  • 11,503
  • 4
  • 63
  • 110