#1 Set source to 1.8 for Java 11 build.
Merged 3 years ago by mbooth. Opened 3 years ago by rgrunber.
rpms/ rgrunber/glassfish-jaxb-api master  into  master

file modified
+13 -2
@@ -1,7 +1,7 @@ 

  %global oname jaxb-api

  Name:          glassfish-jaxb-api

  Version:       2.2.12

- Release:       14%{?dist}

+ Release:       15%{?dist}

  Summary:       Java Architecture for XML Binding

  License:       CDDL-1.1 or GPLv2 with exception

  URL:           http://jaxb.java.net/
@@ -14,6 +14,7 @@ 

  

  BuildRequires:  java-javadoc

  BuildRequires:  maven-local

+ BuildRequires:  mvn(jakarta.activation:jakarta.activation-api)

  BuildRequires:  mvn(net.java:jvnet-parent:pom:)

  BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)

  
@@ -49,6 +50,12 @@ 

  

  cp -p %{SOURCE1} pom.xml

  

+ # Set source/target to 1.8 for Java 11 build

+ %pom_xpath_set "pom:plugin[pom:artifactId='maven-compiler-plugin']/pom:configuration/pom:source" "1.8"

+ %pom_xpath_set "pom:plugin[pom:artifactId='maven-compiler-plugin']/pom:configuration/pom:target" "1.8"

+ 

+ %pom_add_dep jakarta.activation:jakarta.activation-api

+ 

  %pom_remove_plugin org.codehaus.mojo:buildnumber-maven-plugin

  %pom_remove_plugin org.glassfish.copyright:glassfish-copyright-maven-plugin

  %pom_remove_plugin org.glassfish.build:gfnexus-maven-plugin
@@ -63,7 +70,7 @@ 

  

  %build

  %mvn_file :%{oname} %{oname}

- %mvn_build

+ %mvn_build -- -Dsource=1.8

  

  %install

  %mvn_install
@@ -73,6 +80,10 @@ 

  %files javadoc -f .mfiles-javadoc

  

  %changelog

+ * Fri Jun 26 2020 Roland Grunberg <rgrunber@redhat.com> - 2.2.12-15

+ - Set source to 1.8 for Java 11 build.

+ - Add jakarta.activation-api as a dependency.

+ 

  * Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.12-14

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

  

  • Add jakarta.activation-api as a dependency.

Signed-off-by: Roland Grunberg rgrunber@redhat.com

Does %mvn_build -- -Dsource=1.8 work?

I've needed to do supply -Dmaven.compiler.source=1.8 instead to achieve this.

Does %mvn_build -- -Dsource=1.8 work?
I've needed to do supply -Dmaven.compiler.source=1.8 instead to achieve this.

-Dsource is a user property [1] detected by maven-javadoc-plugin, and not maven-compiler-plugin, so setting it will fix issues of javadoc generation. It's really badly named, but it does work nicely.

There are some cases where maven.compiler.{source,target} are required but in this case, the pom file that comes with glassfish-jaxb-api sets source/target to 1.5 in the configuration. Setting the user property doesn't override this, so I did that through pom_xpath_set in the specfile. Looking back, a more direct option would be to just manually adjust the pom since it's actually under version control.

[1] https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#source

Ah, that makes sense. Thanks for the explanation, changes look good.

Pull-Request has been merged by mbooth

3 years ago
Metadata