简体   繁体   English

Gradle Maven插件:uploadArchives无法找到/ tmp / gradle_empty_settings xml

[英]Gradle maven plugin: uploadArchives cannot find /tmp/gradle_empty_settings xml

I just switched from Eclipse and Maven to Android Studio and Gradle for my Android projects. 对于我的Android项目,我只是从Eclipse和Maven切换到了Android Studio和Gradle。

Now I would like my Jenkins server to build and upload release versions to my self hosted Nexus server. 现在,我希望我的Jenkins服务器能够构建发行版本并将其上传到自托管的Nexus服务器。

For this I added those lines to my build.gradle 为此,我将这些行添加到了build.gradle中

apply plugin: 'maven'

group = "de.myapp"
version = '2.2.0'

android {
    ...
}

uploadArchives {
    repositories {
        mavenDeployer {
            maven {
                name "snapshot_repo"
                url "http://192.168.178.85:8081/nexus/content/repositories/myapp_snapshots"

                credentials {
                    username  "admin"
                    password  "admin123"
                }
            }
        }
    }
}

The building process works fine but I can't upload any project to the Nexus server without getting this strange message: 构建过程可以正常工作,但是在没有收到以下奇怪消息的情况下,我无法将任何项目上传到Nexus服务器:

:myapp_testname:assembleDebug :myapp_testname:uploadArchives Upload http://192.168.178.85:8081/nexus/content/repositories/myapp_snapshots/de/myapp/myapp_testname/2.2.0/ivy-2.2.0.xml Upload http://192.168.178.85:8081/nexus/content/repositories/myapp_snapshots/de/myapp/myapp_testname/2.2.0/ivy-2.2.0.xml.sha1 [ant:null] Error reading settings file '/tmp/gradle_empty_settings56173630026020664.xml' - ignoring. :myapp_testname:assembleDebug:myapp_testname:uploadArchives上传http://192.168.178.85:8081/nexus/content/repositories/myapp_snapshots/de/myapp/myapp_testname/2.2.0/ivy-2.2.0.xml上传http://192.168 .178.85:8081 / nexus / content / repositories / myapp_snapshots / de / myapp / myapp_testname / 2.2.0 / ivy-2.2.0.xml.sha1 [ant:null]读取设置文件'/tmp/gradle_empty_settings56173630026020664.xml'时出错-忽略。 Error was: /tmp/gradle_empty_settings56173630026020664.xml (No such file or directory) 错误是:/tmp/gradle_empty_settings56173630026020664.xml(没有这样的文件或目录)

BUILD SUCCESSFUL 建立成功

Total time: 3 mins 31.555 secs Build step 'Invoke Gradle script' changed build result to SUCCESS Archiving artifacts Finished: SUCCESS 总时间:3分钟31.555 secs构建步骤“ Invoke Gradle脚本”将构建结果更改为SUCCESS归档工件完成:SUCCESS

I will get two ivy files on the repository but nothing more. 我将在存储库中获得两个ivy文件,仅此而已。

It seems like gradle cannot create the tmp file. 似乎gradle无法创建tmp文件。 But I don't know why. 但是我不知道为什么。

When I execute this on my local windows machine I will get the same error (just with another tmp folder) 当我在本地Windows计算机上执行此操作时,我将收到相同的错误(仅在另一个tmp文件夹中)

Does anyone know how to solve this issue? 有谁知道如何解决这个问题?

Well, I just found the problem and the solution: 好吧,我刚刚找到了问题和解决方案:

I'm using several flavors and buildTypes (free/premium and debug/release) in my app. 我在我的应用程序中使用了几种口味和buildTypes(免费/高级和调试/发行版)。 This means there is no real "default" variant. 这意味着没有真正的“默认”变体。 In this case you need this line in your module's build.gradle to publish your different build types 在这种情况下,您需要模块的build.gradle中的这一行来发布不同的构建类型

android {
    ...
    publishNonDefault true
    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM