fedora-java / javapackages

Macros and scripts for Java packaging support
Other
7 stars 15 forks source link

Build openjfx8 package that needs openjdk 1.8 is impossible #88

Closed deamn closed 3 years ago

deamn commented 3 years ago

Before, for building openjfx8 these instructions was sufficient to build with maven and openjdk 1.8:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
%mvn_build

Now, on rawhide (f35), the JVM will always be replaced by the default JVM (openjdk 11) by the script mvn_build.py.

In debug mode, I saw that mvn_build.py build that command to start the build: xmvn --batch-mode --offline --debug -Dxmvn.debug verify org.fedoraproject.xmvn:xmvn-mojo:install org.fedoraproject.xmvn:xmvn-mojo:javadoc org.fedoraproject.xmvn:xmvn-mojo:builddep

The output is (begin):

Apache Maven 3.6.3 (Red Hat 3.6.3-8)
Maven home: /usr/share/xmvn
Java version: 11.0.11, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-4.fc34.x86_64

Now if I try to change JAVA_HOME before xmvn, the JAVA_HOME is changed: export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk && xmvn --batch-mode --offline --debug -Dxmvn.debug verify org.fedoraproject.xmvn:xmvn-mojo:install org.fedoraproject.xmvn:xmvn-mojo:javadoc org.fedoraproject.xmvn:xmvn-mojo:builddep

The output:

Apache Maven 3.6.3 (Red Hat 3.6.3-8)
Maven home: /usr/share/xmvn
Java version: 1.8.0_292, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-4.fc34.x86_64/jre

Could you change the behavior of the mvn_build.py to add the possibility to change the JVM? I could propose a PR if you are ok with a new argument? For example: %mvn_build --java-home /usr/lib/jvm/java-1.8.0-openjdk

mizdebsk commented 3 years ago

You can use OpenJDK 8 by simply switching BuildRequires: maven-local to BuildRequires: maven-local-openjdk8. For example: https://src.fedoraproject.org/rpms/plexus-utils/c/cbe0036 Does this solve your issue?

deamn commented 3 years ago

Yes, it solve my problem, but now, I have an issue on javadoc. I build with that command: %mvn_build -f --xmvn-javadoc But at the end, I have this error [ERROR] Failed to execute goal org.fedoraproject.xmvn:xmvn-mojo:4.0.0-SNAPSHOT:javadoc (default-cli) on project javafx: Javadoc failed with exit code 1 That is related to:

error: package javax.annotation does not exist
@javax.annotation.Generated("Generated by javafx.builder.processor.BuilderProcessor")

I tried to add BuildRequires: jakarta-annotations But without success.

mizdebsk commented 3 years ago

error: package javax.annotation does not exist @javax.annotation.Generated("Generated by javafx.builder.processor.BuilderProcessor")

It sounds like pom.xml is missing the right dependency, you can try adding it.

Since the original issue is resolved i'll close this.