How can I update a property in a Maven POM?

后端 未结 7 690
耶瑟儿~
耶瑟儿~ 2020-12-13 18:23

I have two top-level Maven projects, backend and frontend, that advance versions at their own individual pace. Since each has multiple modules, I d

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 18:56

    The following applies to versions:update-properties goal. I think the same would apply to versions:update-property.

    The goal by default only works if a corresponding property definition and dependency declaration appear in the same POM file.

    If, say, the property is defined in a project POM but used in a dependency declaration in a module POM, then the following config is required in the project POM for automatic update via Versions plugin.

      
        3.7.11
      
    ...
    
      
        
          
             org.codehaus.mojo
             versions-maven-plugin
             2.2
             
               
                
                  my.version
                  
                    
                      com.acme.test
                      demo-arti
                    
                  
                
              
            
          
        
      
    

    The plugin configuration comes into action when the Versions maven plugin runs against the POM and attempts to update the property. The configuration tells the Versions plugin that the property will be used for the stated dependency "in a POM somewhere" even if not in the present POM.

提交回复
热议问题