On 2018-02-03T13:43:18 +0000
Mark Raynsford <org.apache.maven.u...@io7m.com> wrote:
>
> It seems like I'd need to compile the module-info.java against a fake
> source directory (to stop the compiler complaining that the module is
> empty) and then insert the resulting module-info.class file into the
> shaded jar file afterwards. This seems fairly ugly though. Is there a
> better way?

Actually, ignore my question!

I have hacked together something using the truezip-maven-plugin and
a separate compiler plugin execution to compile a module-info.java
file as described.

Unfortunately, the resulting jar doesn't run when executed as a modular
jar, presumably due to internal classloading and reflection hacks on the
part of the Maven and Resolver APIs:

Exception in thread "main"
com.io7m.resolver.internal.org.eclipse.aether.resolution.ArtifactResolutionException:
Could not transfer artifact com.google.guava:guava:jar:null from/to
central (https://repo.maven.apache.org/maven2/):
java.lang.IllegalAccessException: class
com.io7m.resolver.internal.org.apache.http.impl.client.CloseableHttpResponseProxy
(in module com.io7m.resolver) cannot access class
com.sun.proxy.jdk.proxy1.$Proxy0 (in module jdk.proxy1) because module
jdk.proxy1 does not export com.sun.proxy.jdk.proxy1 to module
com.io7m.resolver

I suspect this approach simply cannot work.

-- 
Mark Raynsford | http://www.io7m.com

Attachment: pgpg9qmV0DPdW.pgp
Description: OpenPGP digital signature

Reply via email to