【问题标题】:No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer没有这样的属性:nexusUsername 类:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
【发布时间】:2014-10-31 13:06:21
【问题描述】:

我正在尝试将 gradle 项目添加到 Eclipse,但此错误已损坏。

FAILURE: Build failed with an exception.

* Where:
Script '/Users/user/Downloads/AndroidSlidingUpPanel-master/maven_push.gradle' line: 22

* What went wrong:
A problem occurred configuring project ':demo'.
> A problem occurred configuring project ':library'.
> No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

和 build.gradle

// Top-level build file where you can add configuration options common to all sub-        projects/modules.
buildscript {
  repositories {
    mavenCentral()
  }

 dependencies {
    classpath 'com.android.tools.build:gradle:0.12.+'
 }
}

 def isReleaseBuild() {
 return version.contains("SNAPSHOT") == false
 } 

allprojects {
version = VERSION_NAME
group = GROUP

  repositories {
    mavenCentral()
  }
}

如果有人有解决此问题的任何想法,我将不胜感激。

【问题讨论】:

    标签: android eclipse gradle


    【解决方案1】:

    评论 maven_push.gradle 的第 21 到 23 行似乎可以解决问题

    repository(url: sonatypeRepositoryUrl) {
       authentication(userName: nexusUsername, password: nexusPassword)
    }
    

    编码愉快 :)

    【讨论】:

      【解决方案2】:

      如果您想让构建成为可能,即使有人没有添加 nexusUsername 并且如果您有适当的默认值,您可以使用

      if (!hasProperty('nexusUsername')) {
          ext.nexusUsername = ''
      }
      

      到您的构建脚本。

      【讨论】:

        【解决方案3】:

        创建一个文件 ~/.gradle/gradle.properties,其内容如下:

        nexusUsername=
        nexusPassword=
        

        希望它能解决您的问题。

        【讨论】:

          【解决方案4】:

          如错误消息所示,maven_push.gradle(第 22 行)指的是名为 nexusUsername 的属性,但该属性未定义。很有可能构建假定您在 ~/.gradle/gradle.properties 中定义了这样的属性。

          【讨论】:

            猜你喜欢
            • 2015-04-11
            • 2016-08-28
            • 1970-01-01
            • 1970-01-01
            • 2014-07-14
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2014-01-11
            相关资源
            最近更新 更多