hrldcpr / pcollections

A Persistent Java Collections Library
Other
765 stars 79 forks source link

gradle build fails due to missing properties #112

Closed robobario closed 1 year ago

robobario commented 1 year ago

Hi!

Commands like ./gradlew build fail with exception

./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)

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

FAILURE: Build failed with an exception.

* Where:
Build file '/home/roby/development/redhat-managed-kafka/upstream/pcollections/build.gradle' line: 57

* What went wrong:
A problem occurred evaluating root project 'pcollections'.
> Could not get unknown property 'ossrhUsername' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.
... snip
BUILD FAILED in 6s

I think these dynamic properties need to be in a gradle.properties file, I couldn't find a way to pass them as system props.

The context is we are rebuilding pcollections from source and are currently generating a gradle.properties file with dummy values.

It would be convenient if we didn't have to supply the file to run builds.

Maybe using an alternate syntax they could have default values? The sonatype publish would fail unless you have credentials set up on the host machine.

providers.gradleProperty('ossrhUsername').getOrElse('dummy')

Or is there some other way to build without a gradle.properties file?

Thank you!

hrldcpr commented 1 year ago

Great question! I'm in between things at the moment, so if you're able to test that getOrElse option and open a pull request, I'd be happy to merge it!

Otherwise, I'll try to look at this soon.

robobario commented 1 year ago

Sure, I'll get a PR together, thanks!