Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344118

Summary: internal mvn does not use user settings.xml
Product: z_Archived Reporter: David Biesack <David.Biesack>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description David Biesack CLA 2011-04-28 08:49:21 EDT
Build Identifier: 20110218-0911

When I add a maven launch configuration, it does not honor my user settings.xml
My user settings.xml defines some profiles and the profiles set properties.
The build runs but the properties are not set. 



Reproducible: Always

Steps to Reproduce:
  help:effective

shows only



<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">C:\Users\sasdjb\.m2\repository</localRepository>
  <interactiveMode xmlns="http://maven.apache.org/SETTINGS/1.1.0">false</interactiveMode>
  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <pluginGroup>org.apache.maven.plugins</pluginGroup>
    <pluginGroup>org.codehaus.mojo</pluginGroup>
  </pluginGroups>
</settings>

I have verified that my Maven preferences has my User settings
correct: C:\Users\sasdjb\.m2\settings.xml

If I create an external tools launch configuration to run mvn.bat
and run

  mvn help:effective-settings

I get the complete expected user settings:


<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.0.0">C:\Users\sasdjb\.m2\repository</localRepository>
  <profiles xmlns="http://maven.apache.org/SETTINGS/1.0.0">
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <url>http://aclmvn.unx.sas.com/artifactory/repo</url>
        </repository>
        <repository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <id>snapshots</id>
          <url>http://aclmvn.unx.sas.com/artifactory/repo</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <url>http://aclmvn.unx.sas.com/artifactory/repo</url>
        </pluginRepository>
        <pluginRepository>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <updatePolicy>always</updatePolicy>
          </snapshots>
          <id>snapshots</id>
          <url>http://aclmvn.unx.sas.com/artifactory/repo</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
    <profile>
      <activation>
        <os>
          <family>Windows 7</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <build.type>w64</build.type>
      </properties>
      <id>w64</id>
    </profile>
    <profile>
      <activation>
        <os>
          <family>Windows 7</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <build.type>w32</build.type>
      </properties>
      <id>win</id>
    </profile>
    <profile>
      <activation>
        <os>
          <name>Linux</name>
          <family>unix</family>
        </os>
      </activation>
      <properties>
        <build.type>lax</build.type>
      </properties>
      <id>lax</id>
    </profile>
  </profiles>
  <activeProfiles xmlns="http://maven.apache.org/SETTINGS/1.0.0">
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>
Comment 1 David Biesack CLA 2011-04-28 08:50:38 EDT
Sorry, comments garbled.
Better outline of problem/steps:

Run maven launch configuration with the goal

  help:effective

The console shows only

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">C:\Users\sasdjb\.m2\repository</localRepository>
  <interactiveMode xmlns="http://maven.apache.org/SETTINGS/1.1.0">false</interactiveMode>
  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <pluginGroup>org.apache.maven.plugins</pluginGroup>
    <pluginGroup>org.codehaus.mojo</pluginGroup>
  </pluginGroups>
</settings>

I have verified that my Maven preferences has my User settings
correct: C:\Users\sasdjb\.m2\settings.xml

If I create an external tools launch configuration to run mvn.bat and run

  mvn help:effective-settings

I get the complete expected user settings:

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.0.0">C:\Users\sasdjb\.m2\repository</localRepository>
  <profiles xmlns="http://maven.apache.org/SETTINGS/1.0.0">
    <profile>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <!-- other stuff here -->
      <id>artifactory</id>
    </profile>
    <profile>
      <activation>
xs        <os>
          <family>Windows 7</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <build.type>w64</build.type>
      </properties>
      <id>w64</id>
    </profile>
    <profile>
      <activation>
        <os>
          <family>Windows 7</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <build.type>w32</build.type>
      </properties>
      <id>win</id>
    </profile>
    <profile>
      <activation>
        <os>
          <name>Linux</name>
          <family>unix</family>
        </os>
      </activation>
      <properties>
        <build.type>lax</build.type>
      </properties>
      <id>lax</id>
    </profile>
  </profiles>
  <activeProfiles xmlns="http://maven.apache.org/SETTINGS/1.0.0">
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>
Comment 2 David Biesack CLA 2011-04-28 11:19:31 EDT
user error.
Even though

  help:effetive-settings

does not show my profiles and profile activation, I did get it to work
and the property I'm setting in the profile is getting set correctly.
Comment 3 Denis Roy CLA 2021-04-19 13:24:22 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/