[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-298) Add "addAsLibraries(Archive<?>[]... archives)" to LibraryContainer

Tommy Tynjä (JIRA) jira-events at lists.jboss.org
Thu Jul 14 03:22:23 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614093#comment-12614093 ] 

Tommy Tynjä commented on SHRINKWRAP-298:
----------------------------------------

Proposal: https://github.com/tommysdk/shrinkwrap/commit/a6f602189998dee36390dea787b907709b546991

> 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: http://www.atlassian.com/software/jira

       



More information about the shrinkwrap-issues mailing list