Gradle将工件部署到本地目录内的Maven存储库中

Gradle将工件部署到本地目录内的Maven存储库中

本文介绍了Gradle将工件部署到本地目录内的Maven存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是Gradle相当于Maven的:

 < distributionManagement> 
< repository>
< id> internal.repo< / id>
<名称>临时分段存储库< /名称>
< url> file:// $ {project.build.directory} / mvn-repo< / url>
< / repository>
< / distributionManagement>

< build>
< plugins>
< plugin>
< artifactId> maven-deploy-plugin< / artifactId>
< version> 2.8.1< / version>
<配置>
< altDeploymentRepository> internal.repo :: default :: file:// $ {project.build.directory} / mvn-repo< / altDeploymentRepository>
< / configuration>
< / plugin>
< / plugins>
< / build>

我试过了:

  apply plugin:'maven'

uploadArchives {
repositories {
mavenDeployer {
repository(url:file:/// tmp / mvn-repo)
}
}
}

但它会抛出:

$ $ p $ [ant:null]读取设置文件错误'/ private / var / folders / KH / KH + cubLjEESWzOTqVrx -bU +++ TI / -Tmp- / gradle_empty_settings7564764539012703872.xml' - 忽略。错误是:/private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings7564764539012703872.xml(没有这样的文件或目录)

我正在处理的项目是 git://github.com/SpringSource/spring-data-rest.git 分支 1.0.0.RELEASE ,。

完成Gradle输出:

  gradle uploadArchives 
Groovy配置已被弃用,并计划在Gradle 2.0中删除。通常,groovy的用法可以简单地用编译代替。在某些情况下,可能需要额外配置GroovyCompile和Groovydoc任务的'groovyClasspath'属性。
:uploadArchives
[ant:null]读取设置文件错误'/private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings396071803108301794.xml' - 忽略。错误是:/private/var/folders/KH/KH+cubLjEESWzOTqVrx-bU+++TI/-Tmp-/gradle_empty_settings396071803108301794.xml(没有这样的文件或目录)
:spring-data-rest-core:compileJava最新版本
:spring-data-rest-core:compileGroovy最新版本
:spring-data-rest-core:processResources UP-TO-DATE
:spring- data-rest-core:classes-up-to-date
:spring-data-rest-core:jar -up-to-date b $ b: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 $ b $: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-reposit ory: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升级到日期
:spring-data-rest-webmvc:javadoc UP-TO-DATE
:spring-data-rest-webmvc:javadocJar最新日期
:spring-data-rest-webmvc:sourcesJar UP-TO-DATE
:spring-data-rest-webmvc:uploadArchives

我使用Gradle 1.12。

解决方案

的问题。我正在构建的项目是一个多模块项目,我找到了这些信息:

因此,我已将 uploadArchives 从根级别 build.gradle 添加到项目级别 build.gradle 和这个问题解决了问题。



我认为关于maven的setting.xml的错误信息是非常具有误导性的,应该由Gradle团队解决。


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.

解决方案

Found the cause of the problem. The project I am building is a multi module project, here I have found this information:

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.

这篇关于Gradle将工件部署到本地目录内的Maven存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 18:29