MAVEN Project jar package Conflict resolution method

Source: Internet
Author: User

Maven is really a good project management tool, and you don't need to download the dependency pack in advance, just add it to your profile and download it automatically, compared to the more traditional javaide. However, because of Maven's transitive dependency feature, Maven downloads a dependency package along with the jar package's dependency package, which also introduces the problem of jar package conflict.

Workaround:

1. View dependencies:

If you are using Eclipse for development, you can right-click on your project and then choose the Maven build, run as, and fill in the Goals box with Dependency:tree, enter and run.

If not, you can use the command line, using the command MVN dependency:tree

2. Remove the conflicting dependency package

Add exclusion to the package referenced in Pom.xml, excluding dependencies, such as:

1 <!--Remove a single dependency -2 <Dependency>3     <groupId>Com.alibaba</groupId>4     <Artifactid>Dubbo</Artifactid>5     <version>2.5.3</version>6     <Exclusions>7         <exclusion>8             <Artifactid>Spring</Artifactid>9             <groupId>Org.springframework</groupId>Ten         </exclusion> One     </Exclusions> A </Dependency> - <!--Remove all dependencies - - <Dependency> the     <groupId>Com.alibaba</groupId> -     <Artifactid>Dubbo</Artifactid> -     <version>2.5.3</version> -     <Exclusions> +         <exclusion> -             <Artifactid>*</Artifactid> +             <groupId>*</groupId> A         </exclusion> at     </Exclusions> - </Dependency>

  

MAVEN Project jar package Conflict resolution method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.