title: Reading a maven settings.xml when building with gradle?
body: <p>I have a maven settings.xml located in:</p>
  
  <pre><code> /home/u123/.m2/settings.xml
  </code></pre>
  
  <p>where I specify a remote maven repository:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;settings&gt;
    &lt;profiles&gt;
      &lt;profile&gt;
        &lt;id&gt;default&lt;/id&gt;
        &lt;repositories&gt;
            &lt;repository&gt;
                &lt;id&gt;my.repo&lt;/id&gt;
                 &lt;url&gt;http://myrepo/ &lt;/url&gt;
            &lt;/repository&gt;
        &lt;/repositories&gt;
      &lt;/profile&gt;
    &lt;/profiles&gt;
    &lt;activeProfiles&gt;
      &lt;activeProfile&gt;default&lt;/activeProfile&gt;
    &lt;/activeProfiles&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>In this repo I have deployed an artifact - actually its a gradle plugin.</p>
  
  <p>Now I try to build another project that needs to use this plugin/artifact using the below build.gradle file:</p>
  
  <pre class="lang-java prettyprint-override"><code>apply plugin: 'java'
  apply plugin: 'maven'
  
  buildscript {
      dependencies {
          classpath 'com.test:my-gradle-plugin:1.0.0-SNAPSHOT'
      }
  }
  </code></pre>
  
  <p>But the build fails:</p>
  
  <pre><code>...
  &gt; Could not find group:com.test, module:my-gradle-plugin, version:1.0.0-SNAPSHOT.
  ...
  </code></pre>
  
  <p>Gradle cannot find my-gradle-plugin even though I have the above settings.xml file pointing to the remote maven repository.</p>
  
  <p>If I instead specify the repository <em>inside</em> my build.gradle file it works:</p>
  
  <pre class="lang-java prettyprint-override"><code>buildscript {
      repositories {
          maven {
              url "http://myrepo/"
          }
      }
      dependencies {
          classpath 'com.test:my-gradle-plugin:1.0.0-SNAPSHOT'
      }
  }
  </code></pre>
  
  <p>Based on this post:</p>
  
  <p><a href="http://forums.gradle.org/gradle/topics/have_mavenlocal_check_m2_home_conf_settings_xml" rel="noreferrer">http://forums.gradle.org/gradle/topics/have_mavenlocal_check_m2_home_conf_settings_xml</a></p>
  
  <p>it seems that gradle considers the settings.xml file so what is wrong?</p>