How to pass Maven settings via environmental vars

后端 未结 3 1644
无人共我
无人共我 2020-12-29 23:18

In our setting.xml file we have the following:


    
      deploymentRepo
      repouser<         


        
3条回答
  •  春和景丽
    2020-12-30 00:04

    Yes, you can do this in two ways:

    • passing properties in command line, using variables. For example, you can use in your settings.xml something like this:
    
        
          deploymentRepo
          ${server.username}
          ${server.password}
        
    
    

    And in command line, pass these variables in this way:

    mvn clean package -Dserver.username=yourusername -Dserver.password=yourpassword
    
    • exporting environments properties. For example, if you export (in linux, something like export SERVER_USERNAME=yourusername) SERVER_USERNAME and SERVER_PASSWORD variables, you can use like this:
    
        
          deploymentRepo
          ${env.SERVER_USERNAME}
          ${env.SERVER_PASSWORD}
        
    
    

    For more information about propeties, see the reference documentation.

提交回复
热议问题