Where to keep maven publish related sections of Gradle build file?

Hannes

I do publish an open source library to Maven Central. In order to do that the gradle.build file contains variable references to a gradle.properties file which contains secret information like usernames and passwords.

Of course the build.gradle needs to be published to the public git repository, the gradle.properties should not be published, due to containing all the personal information but without the properties file the build.gradle is not valid.

How are open source projects handling those sensitive data?

M.Ricciuti

Here is a solution based on this answer, with the use of findProperty method to allow users to build your project without providing the publishing credentials (issue you mentioned in your comment above)

  • move credentials outside the project's gradle.properties and put them to your local user /.gradle/gradle.properties configuration file
  • in your publish task definition, use:

    authentication(userName: findProperty('mavenUser'), password: findProperty('mavenPassword'))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Publish WAR file to Maven Repo using Gradle

Publish an aar file to Maven Central with Gradle not working

Where to place gradle build file?

How can i do a gradle publish on teamcity to publish a gradle build that uses the maven plugin?

Ability to convert Gradle Project to Maven in IntelliJ and keep both build files

How can I add docstrings to android maven-publish .aar files in build.gradle.kts?

How can plugin programmatically configure maven-publish publishing and allow build.gradle to modify it

Gradle maven-publish does not build standalone spring-boot application

how to convert maven pom.xml into build.gradle file?

Generate SHA512 Checksum File using maven-publish Plugin in gradle

How to publish a WAR file to maven (Nexus) repository with Jenkins via Gradle task

Gradle composite builds version ingredients and maven publish

How to publish source into local maven repository with Gradle?

setting credentials in gradle via maven-publish

Question about Maven Publish Gradle plugin?

Publish Java artifact to Maven Local with Gradle

Gradle publish to maven repository with scp and private key

Publish multiple Gradle modules in one Maven artifact

Build and publish test classes with gradle.kts

How to publish proguard JAR as Maven Artifact using Gradle Publish Plugin

How to publish a regular, non-Android Java library so that it becomes available for inclusion in Java projects via Maven & Gradle build scripts?

Maven or Gradle build types/variants

convert maven pom to gradle build

How to convert a Maven build to Gradle?

Gradle file to Maven

Gradle how to publish a gradle-plugin to maven central

Replace File in Gradle Build

Share maven plugin configuration between build and reporting sections

How to publish aar file to Apache Archiva with Gradle