Maven plugin version not specified

后端 未结 3 1209
闹比i
闹比i 2021-02-05 06:30

I have just noticed that plugin\'s version is optional in maven. I can still build my module without specifying it. Let\'s take an example with maven-bundle-plugin.



        
3条回答
  •  情书的邮戳
    2021-02-05 07:29

    If you check the maven-metadata.xml file that is in your remote repository (e.g. Nexus) alongside the plugin artifact, you'll see something like this:

    
        com.company.maven.plugins
        some-maven-plugin
        
          0.3.6
          0.3.6
          
            0.1
            0.2
            0.3.0
            0.3.1
            0.3.2
            0.3.4
            0.3.5
            0.3.6
          
          20140414212942
        
      
    

    I think Maven may use the value to decide which plugin to download if the version is not specified.

    Maven 3.0.x gives warnings for missing plugin versions and says "future versions of Maven may refuse to build malformed POMs like these" or something like that. You should always specify the plugin versions so your build is reproducible. Otherwise you can end up with some really hard to find bugs.

提交回复
热议问题