Work accumulation (10)--maven exclude related jar package dependencies

Source: Internet
Author: User

A jar package Commons-io-2.4.jar is referenced in the MAVEN project , because the referenced jar package relies on Hibernate-jpa-2.0-api , and Hibernate-jpa-2.0-api there is a bug, will report

Error:java.lang.NoSuchMethodError:javax.persistence.JoinColumn.foreignKey () Ljavax/persistence/foreignkey;

Or

Java.lang.NoSuchMethodError:javax.persistence.Table.indexes () [Ljavax/persistence/index;

wait a similar error. Because the main project also has the dependence on the Hibernate-jpa-2.0-api, first the pom.xml of the main project is modified, in MyEclipse There is still a reference to Hibernate-jpa-2.0-api-1.0.1.final.jar found in mavendependencies, and it is obvious that this bug The HIBERNATE-JPA version is introduced by Commons-io-2.4.jar dependency, and in the main project pom.xml file, the following modifications are made to the dependencies:

Before modification:

<dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> < Version>2.4</version></dependency>

After modification:

<dependency>  <groupid>commons-io</groupid>   <artifactId>commons-io</artifactId>  <version>2.4</version>   <!--  Add exclude tag -->  <exclusions>    < Exclusion>      <groupid>org.hibernate.javax.persistence</groupid >      <artifactId>hibernate-jpa-2.0-api</artifactId>     </exclusion>    <!--  and <dependency>tag, you can add multiple < Exclusion> exclude multiple dependent  -->   </exclusions></dependency> 

now in There is no reference to Hibernate-jpa-2.0-api.jar found in Maven Dependencies in MyEclipse .

add:

how to find commons-io-2.4.jar dependent Hibernate-jpa-2.0-api.jar , through myeclipse pom.xml The Dependency Graph view under the file , as shown in:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/BA/wKiom1WmO6rxV10LAAM1k69qxZo152.jpg "title=" Dependencygraph.png "alt=" Wkiom1wmo6rxv10laam1k69qxzo152.jpg "/>

through Dependency Graph shows what other jar packages are dependent on the specific jar package .

Finish.

This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1675092

Work accumulation (10)--maven exclude related jar package dependencies

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.