Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle property in local.properties

I'm using Gradle 3.1.2 and I have the following situation.

buildscript {

    repositories {
        maven { url repository }
    }
...

In the gradle.properties file the entry is

repository=https://my.url

I now want to move this property entry to the local.properties file, since it should not be committed into vcs. But gradle cannot seem to find it when it is in local.properties.
Where do I need to place the property so gradle can find it but its not in vcs.

like image 808
Thommy Avatar asked Jun 19 '18 11:06

Thommy


People also ask

Where is Gradle local properties?

The global properties file should be located in your home directory: On Windows: C:\Users\<you>\. gradle\gradle. properties.

How do you pass properties in Gradle?

Using the -D command-line option, you can pass a system property to the JVM which runs Gradle. The -D option of the gradle command has the same effect as the -D option of the java command. You can also set system properties in gradle. properties files with the prefix systemProp.

What is Gradle property?

A Gradle project property is a property that can be accessed in your project's build. gradle and gets passed in from an external source when your build is executed.

Should you commit Gradle properties?

Should you commit Gradle properties? properties is to keep it outside of version control, because team members may use it to customize builds, and it is not desirable to have them accidentally commit changes to that file.


1 Answers

As in https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties described you could use a grade.properties file in your GRADLE_USER_HOME directory (default $HOME/.gradle).

like image 84
Florian P. Avatar answered Dec 28 '22 23:12

Florian P.