sonatype-nexus-community / nexus-repository-apt

A Nexus Repository 3 plugin that allows usage of apt repositories
Eclipse Public License 1.0
105 stars 50 forks source link

enable compilation on java10+ #86

Closed cruwe closed 4 years ago

cruwe commented 5 years ago

When compiling on systems with java10 as on Ubuntu-18.04 + as in $ mvn --version Apache Maven 3.5.2 Maven home: /usr/share/maven Java version: 10.0.2, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.15.0-39-generic", arch: "amd64", family: "unix"

compilation fails with

[INFO] --- karaf-maven-plugin:4.0.9:features-generate-descriptor (plugin-feature) @ nexus-repository-apt --- [WARNING] Error injecting: org.apache.karaf.tooling.features.GenerateDescriptorMojo java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

[ERROR] Failed to execute goal [... ]A required class was missing while executing org.apache.karaf.tooling:karaf-maven-plugin:4.0.9:features-generate-descriptor: javax/xml/bind/JAXBException

Having the dependencies dropped from the standard class path declared at karaf.tooling fixes the issue.

sonatypecla[bot] commented 5 years ago

Thanks for the contribution! Before we can merge this, we need @cruwe to sign the Sonatype Contributor License Agreement.

cruwe commented 5 years ago

I should note that even if the package compiles with the altered pom, it does not start correctly when installed following the instructions. I will amend the commit should that issue be related.

cruwe commented 5 years ago

The issue with nexus not starting correctly was due to my failure to set the version of compress correctly. Works with 1.18.

DarthHater commented 5 years ago

I'm not 100% sure we should do this, Nexus Repo itself is compatible with Java 8 (OpenJDK and OracleJDK from what I know), and plugins will likely be running under that JVM as a result. Curious to your thoughts, obviously.

mpoindexter commented 5 years ago

This seems relatively harmless, if it makes someone's life easier and doesn't impact compilation on JDK 8 (I haven't tested that) I'd vote to merge it. My one question would be whether it's appropriate to have the versions of all the jaxb stuff in here, or if those should be inherited from somewhere.

cruwe commented 5 years ago

First, many thanks for your consideration.

I am no developer, but a Unix systems-/devops-engineer by profession. I am not absolutely sure what a typical developer would have running on his/her workstation. Considering that Linux distros begin to ship Java 10 or 11 by default now (Ubuntu 18.04 is on Java 10 and preparing to lift to 11 soonish from what I remember), the assumption that necessarily, the code will be compiled on Java 8, is a strong one in my estimation.

and are set to 1.8, so code fit for the runtime Java 8 will be generated. So, I strongly suspect that compiling with Java >8 and on =8 will not cause issues - I tried both, I noticed no issues, but I lack the Java specifics to reasonably assert that.

On the other hand, I believe it is no huge issue for anybody stumbling across this issue to figure out the reason and either compile (containerized?) with Java 8 or quickly amend the dependencies. This PR does not constitute a necessity, just a, in my opinion, "nice to have". I can well understand I you take a stance against code clutter (I sometimes do, so I sympathize) and would certainly not be offended if you reject the PR.

Again, thanks for your consideration, cheers!

mpoindexter commented 5 years ago

@DarthHater what do you think we should do here?

paol commented 5 years ago

Just want to leave a +1 for merging this. I wouldn't have been able to compile if I hadn't found this PR.

bhamail commented 4 years ago

APT is now part of Nexus Repository Manager. Version 3.17.0 includes the APT plugin by default. If this is still an issue if using 3.17.0 or later please file an issue at https://issues.sonatype.org/. Links to the new source code location are in the top level README.md