Search code examples
mavenrcptychoe4

How to build two different versions of an e4 RCP application with Maven/Tycho?


I have got an e4 RCP application A. I extend this application with a plugin B which adds GUI functionality via fragments.

My project structure looks like this:

  • Application A
  • Plugin B
  • Target-Platform project
  • deployment project (with the .product file)

So far so good. Now, I would like to deploy two versions of my RCP application. One which includes B and one which does not. I tried to simply add a second deployment project. This works fine within Eclipse IDE.

The problem is that I cannot build the project with Maven. I get the following error:

[ERROR] Internal error: org.eclipse.tycho.p2.target.DuplicateReactorIUsException: Duplicate reactor project IUs.
[ERROR] plugin-b 0.1.qualifier => [D:\test\plugin-b, D:\test\plugin-b-repository]
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: org.eclipse.tycho.p2.target.DuplicateReactorIUsException: Duplicate reactor project IUs.
plugin-b 0.1.qualifier => [D:\test\plugin-b, D:\test\plugin-b-repository]

        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.eclipse.tycho.p2.target.DuplicateReactorIUsException: Duplicate reactor project IUs.
plugin-b 0.1.qualifier => [D:\test\plugin-b, D:\test\plugin-b-repository]

        at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.getPreliminaryReactorProjectUIs(TargetPlatformFactoryImpl.java:369)
        at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:177)
        at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:126)
        at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform(TargetPlatformFactoryImpl.java:1)
        at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform(ReactorRepositoryManagerImpl.java:82)
        at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform(P2DependencyResolver.java:215)
        at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject(DefaultTychoResolver.java:99)
        at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        ... 11 more

How could I deploy the two different versions?


Solution

  • It doesn't make sense to use versions for what you are trying to achieve. With versions, there is always an older and a newer version, with the new version meant to eventually replace the old version. So but if you wanted all your users to use the newer version of your RCP application (be it with or without B), why would you even build the old version?

    This is obviously a rhetorical question: You want your users to be able to choose from two variations of your RCP application. So just give them a different ID (artifactId in the pom.xml and uid in the product file), and your build will run fine.