The specification you're talking about is the Multi Release Jar, and especially the last word is important: Jar.

This only works with Jars and with a MANIFEST file containing Multi-Release: true

Compiling and packaging has never been the issue, the tricky part is testing. If you want to test the jar, you must use the failsafe plugin (or bind surefire to the integration-test phase)

All is described on the multirelease page of the maven-compiler-plugin[1]

thanks,
Robert

[1] https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html

On Thu, 04 Apr 2019 18:14:58 +0200, Russell Gold <russell.g...@oracle.com> wrote:

As of 3.8.0, the maven-compiler-plugin will place javaNNN source under META-INF/versions/NNN, which makes them ready for the jar plugin. But the surefire plugin ignores them! Is there a way to get the surefire plugin to run against them? They would need to be added on the class path ahead of the main output directory. I tried the <additionalClasspathElements> setting, but that adds them later on the path, which is worthless.

Or the tests could run against the built jar, but that violates the maven lifecycle order.

My multirelease parent strategy doesn’t seem to work well for the multi-module case, as it can either build the MR jar normally, letting later modules test against it (but breaking the MR module’s unit tests), or copy the META-INF/versions classes into the output directory, letting the module’s unit test use them, but breaking jar building.

I can see making the configuration much more complex, but it would be easier if there was a way to get the surefire plugin to recognize MR modules.

Thanks,
Russ
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to