36
I have a maven settings.xml located in:
/home/u123/.m2/settings.xml
where I specify a remote maven repository:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>my.repo</id>
<url>http://myrepo/ </url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>
In this repo I have deployed an artifact - actually its a gradle plugin.
Now I try to build another project that needs to use this plugin/artifact using the below build.gradle file:
apply plugin: 'java'
apply plugin: 'maven'
buildscript {
dependencies {
classpath 'com.test:my-gradle-plugin:1.0.0-SNAPSHOT'
}
}
But the build fails:
...
> Could not find group:com.test, module:my-gradle-plugin, version:1.0.0-SNAPSHOT.
...
Gradle cannot find my-gradle-plugin even though I have the above settings.xml file pointing to the remote maven repository.
If I instead specify the repository inside my build.gradle file it works:
buildscript {
repositories {
maven {
url "http://myrepo/"
}
}
dependencies {
classpath 'com.test:my-gradle-plugin:1.0.0-SNAPSHOT'
}
}
Based on this post:
http://forums.gradle.org/gradle/topics/have_mavenlocal_check_m2_home_conf_settings_xml