“gradle publish”错误地报告最新 [英] "gradle publish" wrongly reporting up-to-date

查看:765
本文介绍了“gradle publish”错误地报告最新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建 Apache S4 并将其发布到我们的Nexus存储库。 gradle publishToMavenLocal 工作,所以我添加了

  publishing {
存储库{
maven {
凭证{
用户名admin
密码admin123
}
urlhttp://127.0.0.1:9081 / nexus / content / repositories / releases /
}
}
}

build.gradle 之后应用插件:'maven-publish'。这适用于同一台机器上的其他项目。然而,现在我得到了$ /

pre $ a $ c $ aromanov @ ws:〜/ etc / apache-s4-0.6.0 $ gradle clean publish
构建文件'/home/aromanov/etc/apache-s4-0.6.0/subprojects/s4-benchmarks/s4-benchmarks.gradle':第42行
RepositoryHandler.mavenRepo()方法已被弃用,计划在Gradle 2.0中删除。请改用maven()方法。
运行Apache RAT。排除在.rat-excludes文件中定义UNDEFINED
:clean
:s4-base:clean
:s4-benchmarks:clean
:s4-comm:clean
: s4-core:clean
:s4-tools:clean
:test-apps:clean
:test-apps:consumer-app:clean $ b $:test-apps:producer- app:clean
:test-apps:simple-deployable-app-1:clean
:s4-base:发布UP-TO-DATE
:s4-benchmarks:publish UP-TO- DATE
:s4-comm:发布UP-TO-DATE
:s4-core:发布最新日期
:s4-tools:发布最新日期
:test-apps:发布UP-TO-DATE
:test-apps:consumer-app:发布UP-TO-DATE
:test-apps:producer-app:发布UP-TO-DATE
:test-apps:简单部署-app-1:发布最新日期

建立成功

总时间:10.468秒

使用 gradle -i 我得到

 选定的主要任务'publish'
要执行的任务:[task':s4-base:publish',task':s4-benchmarks:发布',任务':s4-comm:发布',任务':s 4-core:publish',task':s4-tools:publish',task':test-apps:publish',task':test-apps:consumer-app:publish',task':test-apps:producer- app:publish',task':test-apps:simple-deployable-app-1:publish']
:s4-base:publish(Thread [main,5,main])。
:s4-base:发布
跳过任务':s4-base:publish',因为它没有任何操作。
:s4-base:发布UP-TO-DATE
:s4-base:发布(Thread [main,5,main])完成。花了0.005秒。
...等等其他子项目

Nexus存储库没有输出。我怎样才能解决这个问题?



UPDATE:如果我使用用户指南第51章中的配置,替换 ivy maven

  uploadArchives {
repositories {
maven {
凭证{
用户名admin
密码admin123
}
urlhttp://127.0.0.1:9081/nexus/content / repositories / releases /
}
}
}

然后上传工作,但它上传jar和ivy.xml,没有POM。使用第52章的配置:

 配置{
deployerJars
}

依赖关系{
deployerJarsorg.apache.maven.wagon:wagon-http:2.2
}

uploadArchives {
configuration = configurations.deployerJars
存储库{
mavenDeployer {
repository(url:http://127.0.0.1:9081/nexus/content/repositories/releases/){
authentication(userName:admin, )b





$ $ b

我得到

  aromanov @ ws:〜/ etc / apache-s4-0.6.0 $ gradle -i上传
开始构建
启动文件锁定侦听器线程。
...
发布配置:配置':s4-base:deployerJars'
发布到资源库'mavenDeployer'
[ant:null]读取设置文件错误'/ tmp / gradle_empty_settings2934509160228124339.xml' - 忽略。错误是:/tmp/gradle_empty_settings2934509160228124339.xml(没有这样的文件或目录)
:s4-base:uploadArchives(Thread [main,5,main])已完成。花了1.113秒。
...

完整的构建脚本

解决方案

如果找不到任何操作,它会标记为最新
我使用的是gradle 2.4,它的功能就像一个魅力

  publishing {
publications {
mavenJava(MavenPublication){
from components.java
}
}
知识库{
maven {
凭证{
用户名'admin '
密码'密码'
}
urlhttp:// baseUrl / artifactory / libs-release-local
}
}
}

您需要提供发布资料库和出版物。


I'm trying to build Apache S4 and publish it to our Nexus repository. gradle publishToMavenLocal worked, so I added

publishing {
    repositories {
        maven {
            credentials {
                username "admin"
                password "admin123"
            }
            url "http://127.0.0.1:9081/nexus/content/repositories/releases/"
        }
    }
}    

to build.gradle after apply plugin: 'maven-publish'. This worked for other projects on the same machine. However, now I get

aromanov@ws:~/etc/apache-s4-0.6.0$ gradle clean publish
Build file '/home/aromanov/etc/apache-s4-0.6.0/subprojects/s4-benchmarks/s4-benchmarks.gradle': line 42
The RepositoryHandler.mavenRepo() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the maven() method instead.
Runs Apache RAT. Exclusions are defined in .rat-excludes fileUNDEFINED
:clean
:s4-base:clean
:s4-benchmarks:clean
:s4-comm:clean
:s4-core:clean
:s4-tools:clean
:test-apps:clean
:test-apps:consumer-app:clean
:test-apps:producer-app:clean
:test-apps:simple-deployable-app-1:clean
:s4-base:publish UP-TO-DATE
:s4-benchmarks:publish UP-TO-DATE
:s4-comm:publish UP-TO-DATE
:s4-core:publish UP-TO-DATE
:s4-tools:publish UP-TO-DATE
:test-apps:publish UP-TO-DATE
:test-apps:consumer-app:publish UP-TO-DATE
:test-apps:producer-app:publish UP-TO-DATE
:test-apps:simple-deployable-app-1:publish UP-TO-DATE

BUILD SUCCESSFUL

Total time: 10.468 secs

Using gradle -i I get

Selected primary task 'publish'
Tasks to be executed: [task ':s4-base:publish', task ':s4-benchmarks:publish', task ':s4-comm:publish', task ':s4-core:publish', task ':s4-tools:publish', task ':test-apps:publish', task ':test-apps:consumer-app:publish', task ':test-apps:producer-app:publish', task ':test-apps:simple-deployable-app-1:publish']
:s4-base:publish (Thread[main,5,main]) started.
:s4-base:publish
Skipping task ':s4-base:publish' as it has no actions.
:s4-base:publish UP-TO-DATE
:s4-base:publish (Thread[main,5,main]) completed. Took 0.005 secs.
... so on for other subprojects

There is no output at the Nexus repository. How can I fix this?

UPDATE: if I use configuration from chapter 51 of the User Guide, replacing ivy by maven:

uploadArchives {
    repositories {
        maven {
            credentials {
                username "admin"
                password "admin123"
            }
            url "http://127.0.0.1:9081/nexus/content/repositories/releases/"
        }
    }
}

then upload works, but it uploads jars and ivy.xml, without POMs. With config from Chapter 52:

configurations {
    deployerJars
}

dependencies {
    deployerJars "org.apache.maven.wagon:wagon-http:2.2"
}

uploadArchives {
    configuration = configurations.deployerJars
    repositories {
        mavenDeployer {
            repository(url: "http://127.0.0.1:9081/nexus/content/repositories/releases/") {
                authentication(userName: "admin", password: "admin123")
            }
        }
    }
}

I get

aromanov@ws:~/etc/apache-s4-0.6.0$ gradle -i upload
Starting Build
Starting file lock listener thread.
...
Publishing configuration: configuration ':s4-base:deployerJars'
Publishing to repository 'mavenDeployer'
[ant:null] Error reading settings file '/tmp/gradle_empty_settings2934509160228124339.xml' - ignoring. Error was: /tmp/gradle_empty_settings2934509160228124339.xml (No such file or directory)
:s4-base:uploadArchives (Thread[main,5,main]) completed. Took 1.113 secs.
...

The complete build script.

解决方案

If no any action found, it will mark as up to date . I am using gradle 2.4 and this is working like a charm

publishing {
publications {
    mavenJava(MavenPublication) {
        from components.java
    }
}
repositories {
maven {
  credentials {
    username 'admin'
    password 'password'
  }
  url "http://baseUrl/artifactory/libs-release-local"
}
}
}

you need to provide publish repositories and publications.

这篇关于“gradle publish”错误地报告最新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆