how to exclude all artifacts from a group in maven?

后端 未结 3 1293
不知归路
不知归路 2021-02-02 07:01

I am using maven 3 with the Enforcer plugin configured to force version convergence. I am using Spring 3.1.2 and Spring Security 3.1.3.

The problem is that Spring 3.1.3

相关标签:
3条回答
  • 2021-02-02 07:31

    This worked for me, excluding all artifacts for groupId org.springframework:

    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
    
    0 讨论(0)
  • 2021-02-02 07:36

    This probably won't help you much, but there is a feature request to allow wildcards in exclusions, however it is not in the current release version of Maven (3.0.4). (Edit: this feature is now present in Maven 3.2.1)

    https://issues.apache.org/jira/browse/MNG-3832

    Interesting is a comment in this JIRA issue:

    Not sure what's going on, but this seems to work in Maven 3.0.3, using this:

    <exclusion>
        <groupId>*</groupId>
        <artifactId>*</artifactId>
    </exclusion>
    

    However, this produces these warnings:

    [WARNING] 'dependencies.dependency.exclusions.exclusion.groupId' for my.groupid:my.artifactid:ejb-client with value '*' does not match a valid id pattern. @ line 31, column 30

    [WARNING] 'dependencies.dependency.exclusions.exclusion.artifactId' for my.groupid:my.artifactid:ejb-client with value '*' does not match a valid id pattern. @ line 32, column 33

    So I probably shouldn't be doing it, but it does work.

    So you might be able to use an artifactId wildcard in Maven 3.0.3 or later and have it work, but with warnings and with no guarantee of compatibility with later versions.

    0 讨论(0)
  • 2021-02-02 07:41

    I encountered the same problem. I think you should explicit include Spring 3.2.x in your pom.xml to enforce the spring version in level 0 when Maven solve the conflict jars. Please refer to: http://www.baeldung.com/spring-security-with-maven

    0 讨论(0)
提交回复
热议问题