How to exclude older versions of maven dependency and use new version of it?

前端 未结 1 652
清歌不尽
清歌不尽 2020-12-19 03:34

I am working with Maven project and I have two projects, ProjectA and ProjectB. My ProjectA is a maven library whose pom looks like th

1条回答
  •  萌比男神i
    2020-12-19 04:13

    There may be incompatible differences between the version of a library that a dependency requires and the one you want to use. If you are happy to take this risk, you can use maven exclusions to ignore transitive dependencies.

    You can exclude, for example, spring-core from being brought in by PartialKernel by adding:

    
        com.texture.partial.core
        PartialKernel
        
            
                org.springframework
                spring-core
            
        
    
    

    Note that you will have to do this for every dependency that brings in spring dependencies.

    Now define the version of spring-core you want to use in the top level pom dependency management section:

    
      
        
            org.springframework
            spring-core
            4.1.6.RELEASE
        
       
    
    

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