Maven command to determine which settings.xml file Maven is using

前端 未结 6 1865
余生分开走
余生分开走 2020-11-30 16:54

How do I use maven command line to determine which settings.xml file Maven is picking up?

6条回答
  •  醉酒成梦
    2020-11-30 17:28

    Your comment to cletus' (correct) answer implies that there are multiple Maven settings files involved.

    Maven always uses either one or two settings files. The global settings defined in (${M2_HOME}/conf/settings.xml) is always required. The user settings file (defined in ${user.home}/.m2/settings.xml) is optional. Any settings defined in the user settings take precedence over the corresponding global settings.

    You can override the location of the global and user settings from the command line, the following example will set the global settings to c:\global\settings.xml and the user settings to c:\user\settings.xml:

    mvn install --settings c:\user\settings.xml 
        --global-settings c:\global\settings.xml
    

    Currently there is no property or means to establish what user and global settings files were used from with Maven. To access these values, you would have to modify MavenCli and/or DefaultMavenSettingsBuilder to inject the file locations into the resolved Settings object.

提交回复
热议问题