[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-330) exclusion after includeDependenciesFromPom doesn't exclude artifacts

Karel Piwko (Commented) (JIRA) jira-events at lists.jboss.org
Sun Oct 23 12:36:45 EDT 2011


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

Karel Piwko commented on SHRINKWRAP-330:
----------------------------------------

This shouldn't be possible by the api, exclusion() should not be exposed to user at this point.

Following code is available in 2.0.0 API
{code}
@Test
    public void testIncludeFromPomWithExclusionFilter() {
        File[] jars = DependencyResolvers.use(MavenDependencyResolver.class)
                .loadEffectiveFromPom("target/poms/test-filter.xml")
                .importAnyDependencies(new ExclusionFilter("org.jboss.shrinkwrap.test:test-deps-c")).resolveAsFiles();

        Assert.assertEquals("Exactly 3 files were resolved", 3, jars.length);
        new FileValidationUtil("test-deps-a", "test-deps-d", "test-deps-e").validate(jars);

    }

    @Test
    public void testIncludeFromPomWithExclusionsFilter() {

        File[] jars = DependencyResolvers
                .use(MavenDependencyResolver.class)
                .loadEffectiveFromPom("target/poms/test-filter.xml")
                .importAnyDependencies(
                // this is applied before resolution, e.g. has no information about transitive dependencies
                // it means:
                // 1. it excludes whole tree of the exclusion
                // 2. it does not affect transitive dependencies of other elements
                        new ExclusionsFilter("org.jboss.shrinkwrap.test:test-deps-a", "org.jboss.shrinkwrap.test:test-deps-c",
                                "org.jboss.shrinkwrap.test:test-deps-d")).resolveAsFiles();

        Assert.assertEquals("Exactly 1 file was resolved", 1, jars.length);
        new FileValidationUtil("test-deps-e").validate(jars);
    }

{code}

This excludes directly on <dependencies> level, so it does not affect transitive dependencies and does not affect single artifacts, but simply removes appropriate <dependency> element from the resolution.

To use Exclusion on transitives, you should pass the filter to resolveAsXYZ(...)  method.


                
> exclusion after includeDependenciesFromPom doesn't exclude artifacts
> --------------------------------------------------------------------
>
>                 Key: SHRINKWRAP-330
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-330
>             Project: ShrinkWrap
>          Issue Type: Bug
>          Components: ext-resolver
>    Affects Versions: 1.0.0-beta-5
>            Reporter: Marek Schmidt
>
> .addAsLibraries(DependencyResolvers.use(MavenDependencyResolver.class)
> .includeDependenciesFromPom("pom.xml")
> .exclusion("foo:bar")
> .resolveAs(JavaArchive.class));
> doesn't exclude foo:bar from included dependencies from pom.xml

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the shrinkwrap-issues mailing list