java - How to override parent pom JAR's in child POM? -


my parent pom has springboot 1.1.9 version, has spring jms version 4.0.6 part of it.

i want use spring jms 4.1.0. added dependency such in child pom. required jar reflected in maven dependencies. compiles . when run application, gets methodnotfounderror/classnotfounderror. have checked , found uses parent pom jar of jms spring 4.0.6.

my parent pom

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>      <groupid>com.bp.pnc</groupid>     <artifactid>pnc-components-parent</artifactid>     <packaging>pom</packaging>     <version>1.0.128-snapshot</version>     <name>pnc components parent</name>      <parent>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-parent</artifactid>         <version>1.1.9.release</version>     </parent>      <modules>         <module>pncenv</module>         <module>pnccommon</module>         <module>pncweb</module>         <module>pncfeeds</module>         <module>pncpublisher</module>         <module>pncmissingobservation</module>         <module>pncupload</module>     </modules>      <properties>         <project.build.sourceencoding>utf-8</project.build.sourceencoding>          <!-- src version -->         <java.version>1.7</java.version>          <!-- lib versions -->         <log4j.version>1.2.17</log4j.version>         <asm.version>4.1</asm.version>         <activemq.version>5.14.0</activemq.version>          <!-- plugin versions -->         <maven-clean-plugin.version>2.6.1</maven-clean-plugin.version>         <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>         <maven-jar-plugin.version>2.6</maven-jar-plugin.version>         <cobertura-maven-plugin.version>2.6</cobertura-maven-plugin.version>         <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>         <maven-release-plugin.version>2.5.2</maven-release-plugin.version>      </properties> 

how can stop this?

  1. print out dependency tree executing following command:

    mvn dependency:tree 
  2. locate offending library fetching 4.0.6.release version of spring-jms.

  3. let's offending library some-library responsible fetching 4.0.6.release version of spring-jms library. make following changes child pom.xml exclude spring-jms library.

    <dependency>    <groupid>some.group</groupid>    <artifactid>some-library</artifactid>    <exclusions>         <exclusion>             <groupid>org.springframework</groupid>             <artifactid>spring-jms</artifactid>         </exclusion>     <exclusions> </dependency> 
  4. add new 4.1.0.release release of spring-jms in child pom.xml add new version.

    <dependency>     <groupid>org.springframework</groupid>     <artifactid>spring-jms</artifactid>     <version>4.1.0.release</version> </dependency> 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -