1
votes

I'm generating Xtext projects programmatically using the Xtext version 2.17.0 (Java 11). The whole process is:

  1. In my own maven project I'm generating those Xtext projects programmatically.
  2. When projects are generated I write grammar to the runtime project and run mvn compile on the parent Xtext project, in order to generate grammar artifacts (like by running Wme2 workflow in Eclipse IDE).
  3. I add org.eclipse.ui.console;bundle-version="3.8.100" to the manifest of the ui project. Then also one jar to the Bundle-ClassPath, so the final Manifest looks like this:
Bundle-ManifestVersion: 2
Bundle-Name: org.mealy.ui
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: org.mealy.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.mealy,org.mealy.ide,org.eclipse.xtext.ui,org.eclipse
 .xtext.ui.shared,org.eclipse.xtext.ui.codetemplates.ui,org.eclipse.ui.e
 ditors;bundle-version="3.5.0",org.eclipse.ui.ide;bundle-version="3.5.0"
 ,org.eclipse.ui,org.eclipse.compare,org.eclipse.xtext.builder,org.eclip
 se.xtext.xbase.lib;bundle-version="2.14.0",org.eclipse.xtend.lib;bundle
 -version="2.14.0";resolution:=optional,org.eclipse.ui.console;bundle-ve
 rsion="3.8.100"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.mealy.ui
Export-Package: org.mealy.ui.internal,org.mealy.ui.quickfix,org.mealy.ui
 .contentassist
Bundle-Activator: org.mealy.ui.internal.MealyActivator
Bundle-ClassPath: lib/mealyMachine-1.0-SNAPSHOT.jar,
 .
  1. After that I'm generating some source code files etc.
  2. Then I'm manually running mvn package on the parent Xtext project in order to build all the projects and get jars representing Eclipse plugin and language server.

But when running the last point on the 2.17.0 version of the Xtext (with Java 11) something is added to the MANIFEST.MF of the ui Xtext project and mvn package fails with following error:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-plugin:1.3.0:p2-metadata-default (default-p2-metadata-default) on project org.mealy.ui: Execution default-p2-metadata-default of goal org.eclipse.tycho:tycho-p2-plugin:1.3.0:p2-metadata-default failed. IllegalArgumentException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-p2-plugin:1.3.0:p2-metadata-default (default-p2-metadata-default) on project org.mealy.ui: Execution default-p2-metadata-default of goal org.eclipse.tycho:tycho-p2-plugin:1.3.0:p2-metadata-default failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-p2-metadata-default of goal org.eclipse.tycho:tycho-p2-plugin:1.3.0:p2-metadata-default failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 21 more
Caused by: java.lang.IllegalArgumentException
    at org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl.getCanonicalArtifact(P2GeneratorImpl.java:206)
    at org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl.generateMetadata(P2GeneratorImpl.java:148)
    at org.eclipse.tycho.plugins.p2.P2MetadataMojo.attachP2Metadata(P2MetadataMojo.java:157)
    at org.eclipse.tycho.plugins.p2.P2MetadataMojo.execute(P2MetadataMojo.java:116)
    at org.eclipse.tycho.plugins.p2.P2MetadataDefaultMojo.execute(P2MetadataDefaultMojo.java:33)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 22 more

The Manifest.mf of the UI Xtext project looks at the end like this:

Bundle-ManifestVersion: 2
Bundle-Name: org.mealy.ui
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: org.mealy.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.mealy,org.mealy.ide,org.eclipse.xtext.ui,org.eclipse
 .xtext.ui.shared,org.eclipse.xtext.ui.codetemplates.ui,org.eclipse.ui.e
 ditors;bundle-version="3.5.0",org.eclipse.ui.ide;bundle-version="3.5.0"
 ,org.eclipse.ui,org.eclipse.compare,org.eclipse.xtext.builder,org.eclip
 se.xtext.xbase.lib;bundle-version="2.14.0",org.eclipse.xtend.lib;bundle-version="2.14.0";bundle
 -version="2.14.0";resolution:=optional,org.eclipse.ui.console;bundle-ve
 rsion="3.8.100",
 org.eclipse.ui.editors,
 org.eclipse.xtext.xbase.lib;bundle-version="2.14.0",
 org.eclipse.xtext.ui.shared
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.mealy.ui
Export-Package: org.mealy.ui.internal,org.mealy.ui.quickfix,org.mealy.ui
 .contentassist,
 org.mealy.ui.contentassist
Bundle-Activator: org.mealy.ui.internal.MealyActivator
Bundle-ClassPath: lib/mealyMachine-1.0-SNAPSHOT.jar,
 .

Running the same code with Xtext 2.16.0 and Java 8 doesnt produce such error and doesnt write anything to the manifest when running point 5 from my list.

What could be the problem ?

1
what about changing only one variable at a time to see if this is related to Xtext 2.17 or Java 11. Also: did you try tycho 1.4 - Christian Dietrich
besides that: did you check if pom and manifest fit together? - Christian Dietrich
=> can you please provide a sample project on github showing the problem - Christian Dietrich
Also knowing what the something is. The generator writes the manifest so there might be a bug in that code but again we need details - Christian Dietrich
EG the newlines in the manifest look bogus - Christian Dietrich

1 Answers

1
votes

looks like you do stumbled over a bug. as a workaround you can try to disable manifest merging

            eclipsePlugin = {
                enabled = true
                manifest = {
                    merge = false
                }
            }