Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply dummy ossrh credentials when none available #113

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

robobario
Copy link
Contributor

@robobario robobario commented Nov 7, 2023

This enables commands like ./gradlew build to work without supplying credentials in a gradle.properties file.

Now with no gradle.properties file in the project dir or your ~/.gradle dir you can run commands like ./gradlew build and ./gradlew test

[roby@roby pcollections]$ ./gradlew clean test

> Configure project :
Project : => 'org.pcollections' Java module

> Task :compileTestJava
warning: [options] module name in --add-exports option not found: org.junit.jupiter.engine
1 warning

BUILD SUCCESSFUL in 5s

And to check it's picking up the property from the required locations:

  1. no gradle.properties file
./gradlew publish -xsignMavenJavaPublication --debug | grep dummy
2023-11-08T12:00:44.248+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: dummy] and NTLM Credentials [user: dummy, domain: , workstation: ROBY] for authenticating against 'oss.sonatype.org:-1' using NTLM
2023-11-08T12:00:44.248+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: dummy] for authenticating against 'oss.sonatype.org:-1' using null
  1. with gradle.properties containing name/pass == "real" in the project dir
./gradlew publish -xsignMavenJavaPublication --debug | grep real
2023-11-08T12:01:28.727+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: real] and NTLM Credentials [user: real, domain: , workstation: ROBY] for authenticating against 'oss.sonatype.org:-1' using NTLM
2023-11-08T12:01:28.727+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: real] for authenticating against 'oss.sonatype.org:-1' using null
  1. with gradle.properties containing name/pass == "real" in ~/.gradle
./gradlew publish -xsignMavenJavaPublication --debug | grep real
2023-11-08T12:02:12.949+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: real] and NTLM Credentials [user: real, domain: , workstation: ROBY] for authenticating against 'oss.sonatype.org:-1' using NTLM
2023-11-08T12:02:12.949+1300 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: real] for authenticating against 'oss.sonatype.org:-1' using null

Why:
The context is we are rebuilding from source and publishing to a custom maven repository and currently have to inject a gradle.properties file to make the gradle build run.

Closes #112

Why:
This enables commands like `./gradlew build` to work without supplying
credentials in a gradle.properties file.
@hrldcpr
Copy link
Owner

hrldcpr commented Nov 7, 2023

So fast, thanks a lot!

@hrldcpr hrldcpr merged commit 4894304 into hrldcpr:master Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gradle build fails due to missing properties
2 participants