-
Feature Request
-
Resolution: Done
-
Major
-
1.0.0-beta-3
-
None
-
Release Notes
Very often, I use the MavenDependencyResolver to obtain Maven dependencies. I use an interface for this purpose:
public interface Dependencies { public static final Archive<?>[] SEAM_SOLDER = DependencyResolvers.use(MavenDependencyResolver.class) .loadReposFromPom("pom.xml").artifact("org.jboss.seam.solder:seam-solder").exclusion("*") .resolveAs(GenericArchive.class).toArray(new Archive<?>[0]); public static final Archive<?>[] SEAM_CATCH = DependencyResolvers.use(MavenDependencyResolver.class) .loadReposFromPom("pom.xml").artifact("org.jboss.seam.catch:seam-catch").exclusion("*") .resolveAs(GenericArchive.class).toArray(new Archive<?>[0]); ... }
Every dependency is represented by an array of archives (Archive<?>[]) since it may also contain transitive dependencies. Therefore, when adding these libraries to (let's say) web archive, I have to call addAsLibraries() separately for every dependency:
war.addAsLibraries(SEAM_SOLDER).addAsLibraries(SEAM_CATCH).addAsLibraries(SEAM_REST);
I propose to extend the LibraryContainer interface and add the following method:
T addAsLibraries(Archive[]<?>... archives) throws IllegalArgumentException;
This would allow for maven dependencies to be added easily:
war.addAsLibraries(SEAM_SOLDER, SEAM_CATCH, SEAM_REST);