Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jakarta.ee-community] targeting JDK 8 *and* JDK 11?

Hi Bill,

On 9/19/19 2:29 AM, Bill Shannon wrote:
What's the state of the art for building a jar file that contains class
files that will work on JDK 8, and a module-info.class that will work
on JDK 11?

Are you looking just for this or also for ability to have multi-release jars? Are you looking for slightly more advanced things like module-info being altered by the build as needed - ie because you have a main-class in one of the projects (maven-jar-plugin:3.1.2+ is required), or you want to include project version in module info (maven-compiler-plugin:3.8.1+ is required) etc?

All JAXB/JAXWS related projects are somehow dealing with this as all of them are java modules for some time already and some of them are also multi-release jars; jsonp/yasson are another projects to look at eventually - should I pick up some examples, jaxb-api can be one of them - it is small project with module-info, a multi-release jar and compiles everything exactly ones[1], a project which is not MR jar but contains "old" tests which are now being run within JPMS can be metro-policy[2] (its double-compilation is going to be fixed in the (near) future). Old JAXB/SAAJ/JAXWS 'RI's are another examples should you be looking for bigger projects - note that I'm updating them these days to adopt recent changes in maven plugins, so what is there today, may be different tomorrow (or day after :-))...

Based on my experience, if you get on this path, my recommendation is to use Maven 3.6.0. 3.6.1 is safe if you don't need to use Eclipse Tycho, with 3.6.2, the copyright plugin does not work[3]. If there is a need for Ant, make sure 1.10.6+ is used because older versions do not work correctly out-of-the-box if the build uses a task from a library which is a multi-release jar[4]. As for what maven build plugins to use - general advice is to always use the latest versions.

thanks,
--luksa

[1]: https://github.com/eclipse-ee4j/jaxb-api/blob/master/jaxb-api/pom.xml
[2]: https://github.com/eclipse-ee4j/metro-policy/blob/master/policy/pom.xml
[3]: https://github.com/eclipse-ee4j/glassfish-copyright-plugin/issues/7
[4]: https://bz.apache.org/bugzilla/show_bug.cgi?id=62952

  The last time I looked at this all I found were kludges
that resulted in compiling everything twice, or very complex Maven
configurations that depended on using multiple versions of the JDK
to compile.  Is there a better way?  Is there an existing project
that would be a good example?
_______________________________________________
jakarta.ee-community mailing list
jakarta.ee-community@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jakarta.ee-community



Back to the top