How to set env variables for maven to run test correctly?

后端 未结 1 1589
梦谈多话
梦谈多话 2021-02-20 16:45

Is it possible to set env vars in pom.xml that junit tests uses? Netbeans can get env vars and builds project correnctly. But when i use command line (mvn clean -> mvn install),

1条回答
  •  借酒劲吻你
    2021-02-20 17:34

    There are two approaches I know.

    Commandline:

    You can pass it in command line like

    mvn -DAM_HOME=conf install
    

    Using pom :

    If AM_HOM is the variable and the value is conf ,make entry like below.

    
        ...
    
    
     
            org.apache.maven.plugins
            maven-surefire-plugin
            ...
            
                ...
                
                    conf
                
            
        
    
    ...
    
    

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