How do I tell Maven to use the latest version of a dependency?

前端 未结 12 741
慢半拍i
慢半拍i 2020-11-21 11:37

In Maven, dependencies are usually set up like this:


  wonderful-inc         


        
12条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-21 12:22

    If you want Maven should use the latest version of a dependency, then you can use Versions Maven Plugin and how to use this plugin, Tim has already given a good answer, follow his answer.

    But as a developer, I will not recommend this type of practices. WHY?

    answer to why is already given by Pascal Thivent in the comment of the question

    I really don't recommend this practice (nor using version ranges) for the sake of build reproducibility. A build that starts to suddenly fail for an unknown reason is way more annoying than updating manually a version number.

    I will recommend this type of practice:

    
        3.1.2.RELEASE
    
    
    
    
        
            org.springframework
            spring-core
            ${spring.version}
        
    
        
            org.springframework
            spring-context
            ${spring.version}
        
    
    
    

    it is easy to maintain and easy to debug. You can update your POM in no time.

提交回复
热议问题