Gradle deploy artifacts to a maven repository inside a local directory
gradle, maven
Solution
Found the cause of the problem. The project I am building is a multi module project, here I have found this information:
52.6.4.1. Multiple artifacts per project
Maven can only deal with one artifact per project. This is reflected in the structure of the Maven POM. We think there are many situations where it makes sense to have more than one artifact per project. In such a case you need to generate multiple POMs. In such a case you have to explicitly declare each artifact you want to publish to a Maven repository.
So I have moved `uploadArchives` from the root level `build.gradle` to a project level `build.gradle` and this fixed the issue.
I think the error message regarding maven's setting.xml is very misleading and should be fixed by the Gradle team.
Problem
What is Gradle's equivalent of Maven's: ``` <distributionManagement> <repository> <id>internal.repo</id> <name>Temporary Staging Repository</name> <url>file://${project.build.directory}/mvn-repo</url> </repository> </distributionManagement> <build> <plugins> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.1</version> <configuration> <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository> </configuration> </plugin> </plugins> </build> ``` I have tried: ``` apply plugin: 'maven' uploadArchives { repositories { mavenDeployer { repository(url: "file:///tmp/mvn-repo") } } } ``` but it throws: ``` [ant:null] Error reading settings file '/private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings7564764539012703872.xml' - ignoring. Error was: /private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings7564764539012703872.xml (No such file or directory) ``` The project that I am working on is `git://github.com/SpringSource/spring-data-rest.git` branch `1.0.0.RELEASE`, project's build.gradle. Complete Gradle output: ``` gradle uploadArchives The groovy configuration has been deprecated and is scheduled to be removed in Gradle 2.0. Typically, usages of 'groovy' can simply be replaced with 'compile'. In some cases, it may be necessary to additionally configure the 'groovyClasspath' property of GroovyCompile and Groovydoc tasks. :uploadArchives [ant:null] Error reading settings file '/private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings396071803108301794.xml' - ignoring. Error was: /private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings396071803108301794.xml (No such file or directory) :spring-data-rest-core:compileJava UP-TO-DATE :spring-data-rest-core:compileGroovy UP-TO-DATE :spring-data-rest-core:processResources UP-TO-DATE :spring-data-rest-core:classes UP-TO-DATE :spring-data-rest-core:jar UP-TO-DATE :spring-data-rest-core:javadoc UP-TO-DATE :spring-data-rest-core:javadocJar UP-TO-DATE :spring-data-rest-core:sourcesJar UP-TO-DATE :spring-data-rest-core:uploadArchives :spring-data-rest-repository:compileJava UP-TO-DATE :spring-data-rest-repository:compileGroovy UP-TO-DATE :spring-data-rest-repository:processResources UP-TO-DATE :spring-data-rest-repository:classes UP-TO-DATE :spring-data-rest-repository:jar UP-TO-DATE :spring-data-rest-repository:javadoc UP-TO-DATE :spring-data-rest-repository:javadocJar UP-TO-DATE :spring-data-rest-repository:sourcesJar UP-TO-DATE :spring-data-rest-repository:uploadArchives :spring-data-rest-webmvc:compileJava UP-TO-DATE :spring-data-rest-webmvc:compileGroovy UP-TO-DATE :spring-data-rest-webmvc:processResources UP-TO-DATE :spring-data-rest-webmvc:classes UP-TO-DATE :spring-data-rest-webmvc:jar UP-TO-DATE :spring-data-rest-webmvc:javadoc UP-TO-DATE :spring-data-rest-webmvc:javadocJar UP-TO-DATE :spring-data-rest-webmvc:sourcesJar UP-TO-DATE :spring-data-rest-webmvc:uploadArchives ``` I use Gradle 1.12.