2014-10-31 108 views
-2

我想向Eclipse添加gradle项目,但是这个错误已经发生了。没有这样的属性:类的nexusUsername:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

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() 
    } 
} 

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

回答

0

如错误信息所示,maven_push.gradle(第22行)是指名为nexusUsername的属性,但未定义。机会是假设您的~/.gradle/gradle.properties中定义了这样一个属性。

1

如果你想构建可能的,即使有人还没有添加nexusUsername,如果你有一个适当的默认值,可以使用

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

到您的构建脚本。

3

评论线21 maven_push.gradle的23似乎解决了问题

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

编码快乐:)

0

创建一个文件〜/ .gradle /用以下内容gradle.properties:

nexusUsername= 
nexusPassword= 

希望它能解决您的问题。

相关问题