Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with Maven-Tycho build of Xtext project in GitLab CI
Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832806] Fri, 25 September 2020 11:53 Go to next message
Martijn Hendriks is currently offline Martijn HendriksFriend
Messages: 4
Registered: September 2020
Junior Member
Hi,

We are building an Eclipse Xtext based project with Maven and the Tycho plugin. Everything works fine, except for the automated tests in GitLab CI/CD. These fail because somehow the main class in the org.eclipse.equinox.launcher dependency cannot be found:

148908 [INFO] Command line:
[/usr/lib/jvm/java-11-openjdk-amd64/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk, -Dosgi.arch=x86_64, , --add-modules=ALL-SYSTEM, -Dosgi.clean=true, -jar, /builds/qrml/qrml-dsl/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.700.v20200207-2156/org.eclipse.equinox.launcher-1.5.700.v20200207-2156.jar, -debug, -consolelog, -data, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/data, -install, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work, -configuration, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/surefire.properties]
Error: Could not find or load main class
Caused by: java.lang.ClassNotFoundException:


Locally (windows environment, Maven 3.6.3, JDK 13.0.1) this works fine: tests are executed normally as expected during the Maven build. I tried to add the org.eclipse.equinox.launcher explicitly (test scope) but that doesn't help. Juding from the log files, the jar is present. The CI environment is an Ubuntu server with openjdk 11.0.8 and Maven 3.6.0.

Any hints or pointers on how to solve this are greatly appreciated, thanks!

Best regards,
Martijn
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832808 is a reply to message #1832806] Fri, 25 September 2020 12:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi,

do you have a complete stacktrace?
the "(test scope) " statement i dont understand. this is a tycho build, not a pure maven build correct?
do you have Xvnc/Xvfb etc running on Gitlab?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832809 is a reply to message #1832808] Fri, 25 September 2020 12:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
p.s: does a project create with the wizard work for you on your gitlab?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832812 is a reply to message #1832809] Fri, 25 September 2020 13:06 Go to previous messageGo to next message
Martijn Hendriks is currently offline Martijn HendriksFriend
Messages: 4
Registered: September 2020
Junior Member
Here is more logging:

148908 [INFO] Command line:
	[/usr/lib/jvm/java-11-openjdk-amd64/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk, -Dosgi.arch=x86_64, , --add-modules=ALL-SYSTEM, -Dosgi.clean=true, -jar, /builds/qrml/qrml-dsl/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.700.v20200207-2156/org.eclipse.equinox.launcher-1.5.700.v20200207-2156.jar, -debug, -consolelog, -data, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/data, -install, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work, -configuration, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/surefire.properties]
Error: Could not find or load main class 
Caused by: java.lang.ClassNotFoundException: 
148979 [INFO] ------------------------------------------------------------------------
148979 [INFO] Reactor Summary for nl.tue.ele.es.qrml.parent 1.0.0-SNAPSHOT:
148979 [INFO] 
148979 [INFO] nl.tue.ele.es.qrml.parent .......................... SUCCESS [  0.032 s]
148979 [INFO] nl.tue.ele.es.qrml ................................. SUCCESS [ 29.657 s]
148979 [INFO] nl.tue.ele.es.qrml.ide ............................. SUCCESS [  0.885 s]
148979 [INFO] nl.tue.ele.es.qrml.ui .............................. SUCCESS [  0.473 s]
148979 [INFO] nl.tue.ele.es.qrml.lsp ............................. SUCCESS [  4.333 s]
148979 [INFO] nl.tue.ele.es.qrml.gen ............................. SUCCESS [  4.231 s]
148979 [INFO] nl.tue.ele.es.qrml.target .......................... SUCCESS [  0.004 s]
148979 [INFO] nl.tue.ele.es.qrml.feature ......................... SUCCESS [  0.078 s]
148979 [INFO] nl.tue.ele.es.qrml.repository ...................... SUCCESS [  1.147 s]
148979 [INFO] nl.tue.ele.es.qrml.tests ........................... FAILURE [  1.214 s]
148979 [INFO] nl.tue.ele.es.qrml.ui.tests ........................ SKIPPED
148979 [INFO] ------------------------------------------------------------------------
148979 [INFO] BUILD FAILURE
148979 [INFO] ------------------------------------------------------------------------
148979 [INFO] Total time:  02:28 min
148979 [INFO] Finished at: 2020-09-25T09:12:10Z
148979 [INFO] ------------------------------------------------------------------------
148980 [ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:1.7.0:test (default-test) on project nl.tue.ele.es.qrml.tests: An unexpected error occurred while launching the test runtime (process returned error code 1). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 
148980 [ERROR]  --add-modules=ALL-SYSTEM
148980 [ERROR]  -Dosgi.clean=true -jar /builds/qrml/qrml-dsl/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.700.v20200207-2156/org.eclipse.equinox.launcher-1.5.700.v20200207-2156.jar -debug -consolelog -data /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/data -install /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work -configuration /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/surefire.properties in working directory /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests
148980 [ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:1.7.0:test (default-test) on project nl.tue.ele.es.qrml.tests: An unexpected error occurred while launching the test runtime (process returned error code 1). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 
 --add-modules=ALL-SYSTEM
 -Dosgi.clean=true -jar /builds/qrml/qrml-dsl/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.700.v20200207-2156/org.eclipse.equinox.launcher-1.5.700.v20200207-2156.jar -debug -consolelog -data /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/data -install /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work -configuration /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/surefire.properties in working directory /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at 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)
Caused by: org.apache.maven.plugin.MojoFailureException: An unexpected error occurred while launching the test runtime (process returned error code 1). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 
 --add-modules=ALL-SYSTEM
 -Dosgi.clean=true -jar /builds/qrml/qrml-dsl/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.700.v20200207-2156/org.eclipse.equinox.launcher-1.5.700.v20200207-2156.jar -debug -consolelog -data /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/data -install /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work -configuration /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests/target/surefire.properties in working directory /builds/qrml/qrml-dsl/QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent/nl.tue.ele.es.qrml.tests
    at org.eclipse.tycho.surefire.TestMojo.runTest (TestMojo.java:1093)
    at org.eclipse.tycho.surefire.TestMojo.execute (TestMojo.java:712)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at 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)
148981 [ERROR] 
148981 [ERROR] 
148981 [ERROR] For more information about the errors and possible solutions, please read the following articles:
148981 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
148981 [ERROR] 
148981 [ERROR] After correcting the problems, you can resume the build with the command
148981 [ERROR]   mvn <goals> -rf :nl.tue.ele.es.qrml.tests


Quote:

The "(test scope) " statement i dont understand. this is a tycho build, not a pure maven build correct?
do you have Xvnc/Xvfb etc running on Gitlab?


Yes, it is a Tycho build. The project has been created from the Wizard and only slightly modified. I will check whether a "clean" wizard project works on our GitLab.
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832814 is a reply to message #1832812] Fri, 25 September 2020 13:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
please also share your gitlab yml

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832816 is a reply to message #1832814] Fri, 25 September 2020 13:46 Go to previous messageGo to next message
Martijn Hendriks is currently offline Martijn HendriksFriend
Messages: 4
Registered: September 2020
Junior Member
A clean wizard project builds successfully after I configure <useUIHarness>false</useUIHarness> in the ui tests. (I have this configured to false also in the project that doesn't build).

The gitlab-ci.yml is the following:

before_script:
    - apt-get update
    - apt-get install -y default-jre default-jdk
    - apt-get install -y maven

build:
    variables:
    tags:
        - Ubuntu1804-64bit
    script:
        - mkdir /builds/qrml/qrml-dsl/testoutput
        - cd QRML_tooling/qrml-2.0/nl.tue.ele.es.qrml.parent
        - mvn -X verify 2>&1 | tee /builds/qrml/qrml-dsl/testoutput/Maven-debug-output.txt
    artifacts:
      expire_in: 14d
      when: always
      paths:
      - /builds/qrml/qrml-dsl/testoutput


This script worked for the Wizard project. The strange thing is that the main project started from the Wizard and I don't think I modified any pom.xml files except for the root pom to include two other modules and the ui.test pom to disable the UI harness.


Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832819 is a reply to message #1832816] Fri, 25 September 2020 14:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
why not use xnc or xvfb for ui tests
(latet tested this 2 years ago, might have changed: https://gitlab.com/cdietrich/my-xtext-p2-sample/-/blob/master/.gitlab-ci.yml)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Maven-Tycho build of Xtext project in GitLab CI [message #1832864 is a reply to message #1832819] Mon, 28 September 2020 07:00 Go to previous message
Martijn Hendriks is currently offline Martijn HendriksFriend
Messages: 4
Registered: September 2020
Junior Member
Found the cause of the issue: Autoformatting applied to the parent pom.xml broke a line that should not be broken:

 <!-- THE FOLLOWING LINE MUST NOT BE BROKEN BY AUTOFORMATTING -->
<argLine>${platformSystemProperties} ${systemProperties} ${moduleProperties} ${additionalTestArguments}</argLine>


Apparently, breaking this line is no problem on Windows, but causes the "java.lang.ClassNotFoundException" on *nix.

Anyway, thanks for looking into this.
Previous Topic:Help with labeling features
Next Topic:Can I make Xtext throw, when a containment reference is reassigned?
Goto Forum:
  


Current Time: Thu Mar 28 11:08:59 GMT 2024

Powered by FUDForum. Page generated in 0.31168 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top