]
Tommy Tynjä updated SHRINKWRAP-298:
-----------------------------------
Status: Pull Request Sent (was: Coding In Progress)
Git Pull Request:
Add "addAsLibraries(Archive<?>[]... archives)" to
LibraryContainer
------------------------------------------------------------------
Key: SHRINKWRAP-298
URL:
https://issues.jboss.org/browse/SHRINKWRAP-298
Project: ShrinkWrap
Issue Type: Feature Request
Components: api
Affects Versions: 1.0.0-beta-3
Reporter: Jozef Hartinger
Assignee: Tommy Tynjä
Very often, I use the MavenDependencyResolver to obtain Maven dependencies. I use an
interface for this purpose:
{code}
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]);
...
}
{code}
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:
{code}
war.addAsLibraries(SEAM_SOLDER).addAsLibraries(SEAM_CATCH).addAsLibraries(SEAM_REST);
{code}
I propose to extend the LibraryContainer interface and add the following method:
{code}
T addAsLibraries(Archive[]<?>... archives) throws IllegalArgumentException;
{code}
This would allow for maven dependencies to be added easily:
{code}
war.addAsLibraries(SEAM_SOLDER, SEAM_CATCH, SEAM_REST);
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: