2

we're currently trying to upgrade our software solution to Java 8 from previously Java 6. We've already succeeded in getting everything to run and build on our development machines, but are now stuck on our build server being unable to build certain parts with PDE.

We have tried to change multiple settings within the build.properties file, the manifests of the corresponding features, but to no avail. I have also verified, that the rt.jar is a java 8 version of the file.

The error we're getting is:

Syntax error, annotations are only available if source level is 1.5 or greater

In our manifest for the particular bundle generating the problem we have set:

Bundle-RequiredExecutionEnvironment: JavaSE-1.8

Within the build properties file for the build script we have set:

bootClasspath=${java.home}/lib/rt.jar
JavaSE-1.8= ${java.home}/lib/rt.jar
path.jre = ${java.home}
javacSource=1.8
JavacTarget=1.8

Additionally we have set a specific Java 1.8 Compiler in the Eclipse settings for the project instead of the workspace default.

Also at the end of the build I'm getting:

BUILD FAILED
    /QuickBuild/quickbuild-5.0.10/workspace/Eclipse-Builds/Client/buildscripts/buildRCP.xml:20: Java returned: 13

I couldn't find a definite answer what exactly causes the return 13. Apparently it can be a mismatch of 64 Bit eclipse and a 32 bit JDK, but maybe also just a compatability error with Java 1.8. After setting my compiler to verbose from the Ant script calling it, I was able to find the lines

12:47:37,579 INFO  - [java] Override ignored for property "javacSource"
12:47:37,579 INFO  - [java] Override ignored for property "javacTarget"

Apparently the compiler ignores the settings for the build and falls back (or uses a previously somewhere set version) on a java version below 1.5 to compile the code. I can't seem to find out if it is a setting I'm still missing, or I made any mistakes within our build.properties file. The log does not seem to generate any errors for false inputs within the properties file. Is there any way to verify that the settings I have set within the property file are actually used, or am I missing a setting?

Radioo
  • 422
  • 5
  • 18
  • Sounds like your build server is not updated with the latest Java 1.8. Run on the command line on the build server java -version – edjm Apr 30 '19 at 12:17
  • @Elijah the environment variable "JAVA_HOME" for this build is set to a folder "java-8-openjdk-i386". So it should be fine. Also this is only one of several builds. The other ones are Ant builds though, which use the same java directory and are able to compile the java 8 code. – Radioo Apr 30 '19 at 12:24
  • Well what is it doing at line 20 in 'buildRCP.xml'? Note that maven + tycho is the currently recommended way to do RCP builds and has been for quite a while. Not many people are going to remember how the old PDE build worked. – greg-449 Apr 30 '19 at 12:49
  • Does the local `build.properties` of the offending bundle have a line like `javacProjectSettings=true`? Otherwise, `MyBundle/.settings/org.eclipse.jdt.core.prefs` will have no effect in PDE builds. – Stephan Herrmann Apr 30 '19 at 18:38
  • @greg-449 the line executed is ``. Unfortunately I don't have a lot of experience in building projects, but my guess is, that this would try to launch the equinox launcher, but fails to do so. – Radioo May 07 '19 at 06:43
  • @StephanHerrmann it does not have this line, but instead we have set `jre.sompilation.profile=JavaSE-1.8` shouldn't that hardcode the compiler to Java 1.8? – Radioo May 07 '19 at 06:45
  • 1
    You probably have Ant using a 32 bit Java trying to run a 64 bit Launcher (or the other way round). They must all be 64 bit or all 32 bit. – greg-449 May 07 '19 at 06:46
  • @greg-449 I'm getting a Java return code 13 at the end of the build-log, so that would back up your theory. We should be using a full 32 bit environment, but guess I'll have to check if we changed anything to 64 bit in the process of migrating. – Radioo May 07 '19 at 06:51
  • @greg-449 I'm don't think it's a missmatch of environments really. We used all involved packages in the prior working version with Java 7. What I suspect is, that our Ant Script only launches `org.eclipse.equinox.launcher.Main` with a bunch of arguments, that tell it to build the code using `org.eclipse.pde.build_xxx/scripts/productBuild/productBuild.xml`. When compiling though, somehow the PDE build uses the wrong java version and fails, which in return gives the "java returns 13" error for the Ant Build. Could this be possible? – Radioo May 07 '19 at 09:06

1 Answers1

1

I've figured out, that most of those settings were not actually used, since the actual script called by PDE just called the JDT compiler with the source level specified in the jdt.core.prefs file of the eclipse project. Since the eclipse version on our build server does not support Java 8 yet, it couldn't figure out how to compile Java 8 code, and somehow must have reverted back to a source level below 1.5 for compilation. I'll have to look up how to replace the JDT compiler with a newer version in this case.

Radioo
  • 422
  • 5
  • 18