Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Authentication details from gradle.properties does not work #22

Closed
phillipuniverse opened this issue Feb 22, 2014 · 2 comments
Closed

Comments

@phillipuniverse
Copy link

I tried with this in ~/.gradle/gradle.properties:

nexusUsername = 'user'
nexusPassword = 'password

As well as setting the properties on the project itself:

project.ext {
    nexusUsername = 'user'
    nexusPassword = 'password'
}

In both cases, I get a 401 Unauthorized when I invoke gradle uploadArchives. If I don't set any of those properties and let the plugin prompt me, everything gets uploaded fine.

I am using Gradle 1.10:

------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------

Build time:   2013-12-17 09:28:15 UTC
Build number: none
Revision:     36ced393628875ff15575fa03d16c1349ffe8bb6

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:          2.2.0
JVM:          1.7.0_09 (Oracle Corporation 23.5-b02)
OS:           Mac OS X 10.9.1 x86_64

Thanks for the awesome plugin! Kudos for taking all of the weird-ish Maven tricks and throwing it all in one place!

@phillipuniverse
Copy link
Author

Ah HA! Ok, this is my first exploration into Gradle, so forgive my noobie mistake. I just figured out that the properties in gradle.properties work differently than in normal Groovy code in the build script. They are treated like any other properties file (duh!).

So when I had this in gradle.properties:

nexusUsername = 'user'
nexusPassword = 'password'

Gradle treated that as the entire string "'user'" and "'password'", complete with quotes!

Removing the quotes fixed my problem:

nexusUsername = user
nexusPassword = password

Sorry again for the trouble. It is weird though that this didn't work:

project.ext {
    nexusUsername = 'user'
    nexusPassword = 'password'
}

Because it's in the build script I would think that it would treat that like a String and remove the quotes for me. I guess not. Doesn't really matter, I needed it to be in a gradle.properties file anyway.

@bmuschko
Copy link
Owner

It kind of depends on where you define the properties in your build script. Might just be an evaluation order problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants