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