ShrinkWrap Resolver single jar bootstrap module


#1

I’ve been playing with a module for ShrinkWrap Resolver that attempt to minimalize the application classpath foot print; https://github.com/aslakknutsen/shrinkwrap-resolver/commit/86fa060e1c52800727adbcf00c08bac706974507

Currently it has no external/local dependencies and rely on packaging Resolvers dependencies as part of the bootstrap jar file. The module only expose a very simplified version of the Resolver API:

public final class Resolver {

    public static ClassLoader resolveAsClassLoader(String... artifacts);

    public static ClassLoader resolveAsClassLoader(ClassLoader parent, String... artifacts);

    public static File[] resolveAsFiles(String... artifacts);
}

Usage example:

<dependency>
   <groupId>org.jboss.shrinkwrap.resolver</groupId>
   <artifactId>shrinkwrap-resolver-bootstrap-maven</artifactId>
   <version>${project.version}</version>
   <scope>test</scope>
</dependency>
ClassLoader cl = Resolver.resolveAsClassLoader(
        "org.jboss.arquillian.junit:arquillian-junit-container:1.1.8.Final",
        "junit:junit:4.12");

System.out.println(cl.loadClass("org.jboss.arquillian.junit.Arquillian"));

This allow for using Resolve in situations here:

  • Minimal Application ClassLoader footprint is required
  • Conflicts with other Application ClassLoader libs occure
  • Easy usage outside of dependency management systems

ShrinkWrap Resolver in JavaScript via Nashorn
#2

Would it be possible to deploy an entire war (including libs, classes, webapp content) with the shrinkwrap resolver api exposed here?


#3

You could resolve a pre built war for sure,

resolveAsFiles("my:test:war:version")

But currently the ShrinkWrap Importer is not exposed here.


#4

Hello, Aslak,

is the mentioned artifact “shrinkwrap-resolver-bootstrap-maven” currently no in maven central repository?

Thanks, regards,
Vagharshak