gradle.properties file is missing from .gradle folder in windows - gradle

I have installed gradle with chocolatey package manager, but in .gradle directory there is no gradle.properties file. Do I need to re-install gradle? or what should I write besides what I need to add in grdle.properties file If I will create it?
P.S: I use gradle plugin in Spring Tool Suite, and I need to add something in the gradle.properties file concerning the project

The propery file gradle.properties is not created automatically during Gradle installation. You can create this file manually and add your specific configuration into it. Note that there are two places where you can create a gradle.properties file, as described in documentation Gradle configuration properties

Related

How define for Maven's Environment Variable to define Local Repository and Wrapper download location?

I need do mention about Gradle to understand and find the same solution for Maven.
In Gradle exists the GRADLE_HOME and GRADLE_USER_HOME (repository) environment variables, for Maven the former through M2_HOME and about the repository I use the settings.xml file to define the <localRepository> location
For both Maven and Gradle I can define in peace the place about where is installed the software, for example other location than .m2 and .gradle to a secondary disk and even with customized directory names. Same goal about the repository location, both for a secondary disk (remember for Maven through the settings.xml file)
Note: therefore .gradle and .m2 are empty and not used.
In Gradle about the wrapper created, the gradle-wrapper.properties file has:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-#.#.#-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Then the final path is: GRADLE_USER_HOME/wrapper/dists
Therefore observe how GRADLE_USER_HOME (custom location - otherwise .gradle by default) is used to define the:
Local repository
Base path to install the downloaded Gradle through the wrapper
Goal: How accomplish the same behaviour for Maven? I mean, what should be the environment variable name (something like MAVEN_USER_HOME) for the local repository that Maven should recognize automatically? (not using the settings.xml file). It with the purpose to have any Maven wrapper installed according that environment variable name configured (custom location - otherwise .m2 by default) and of course defined the Local Repository too.
Therefore: I need the maven-wrapper.properties using something like MAVEN_USER_HOME (custom location - otherwise .m2 by default) according the developer/user in its machine.
For me, I am using spring boot boilerplate code that is generated from spring.io. Inside come with mvnw.cmd. By setting MAVEN_USER_HOME to a customized location, running mvnw.cmd will download the maven to that customized location.
Once done, I still need to manually go to that downloaded maven location to configure the settings.xml to point to a customized location for the maven libraries repo.
So at the moment, sadly, seem like the settings.xml is required to configure the repo, and MAVEN_USER_HOME environment variable has nothing to do with the repo.

How do I remove gradle support from an intellij project?

I have a scala/sbt project, and there is a build.gradle file from when I was experimenting one time. Intellij saw the build.gradle and has enabled gradle for the project. Can I turn off gradle for the project?
I have deleted my build.gradle and any gradle directories in my project but I keep getting messsages like the below, so I'm guessing there is a setting in intellij I need to turn off.
7:31 pm The IDE modules below were removed by the Gradle import:
knot-alpha
You can open dialog to select the ones you need to restore.
Close the project
Remove all Gradle related files and directories:
build.gradle
settings.gradle
gradle.properties
gradle/
Delete the hidden .idea/ directory
Reimport project
In addition to Fracisco Mateos answer:
It should be enough to remove the gradle.xml from the hidden .idea directory. This will remove the Gradle "nature" of the project in IntelliJ without having to delete all your workspace metadata.
Removing the build.gradle, settings.gradle, gradle.properties and gradle directory probably isn't necessary, but, of course, makes sense in order to have a clean project.

gradle wrapper not overriding default wrapper properties

We are using gradle wrapper for our project
There is a gradle-wrapper.properties generated as part of the wrapper
We would like to know whether the gradle-wrapper.properties in the wrapper will over ride the gradle.properties available in the user home directory.
For eg: if Developer has a different gradle installation and has a gradle.properties in his machine, and when we enforce gradle wrapper, we observed that the local gradle.properties is considered for build.
Is this the expected behavior?
No, the gradle properties file specifies the properties to be used by gradlew script, like what version to download and use, and not properties for the build process.
Moreover, the gradle.properties file should be shipped along with your source code.

How can a Gradle plugin access its own files?

My custom Gradle plugin contains files which it wants to copy into the output produced by the build that uses my plugin.
How can my plugin access its own files?
All variables I have tried always refer to the project that applied my plugin, but not to the contents of the plugin.
It seems that if files are located in the jar itself it can be loaded via the following construct:
getClass().getResource("resourceName")

Specify project version

I have found 3 ways to define my project version.
In the documentation http://www.gradle.org/docs/current/userguide/dependency_management.html they talk to specify it in the manifest or the foldername (which already contains the project name).
Coming from a maven project I'm used to defining my version in my pom.xml and I have found project that also define their version in the gradle.build file in the version property
I'm looking for the correct way to handle my project version, so I can also depend on a certain version of my project.
The link that you have shared talks more about dependency management, and about good practises for versioning your artifacts.
There is a one-to-one relationship between a Project and a build.gradle file.
Also your build.gradle gives you a property:
version - The version of this project. Gradle always uses the toString() value of the version. The version defaults to unspecified.
This fits in for the project version.
You can set it directly in build.gradle, but depending on your use case you could pass it externally - using gradle.properties for example in multi-project builds.
You can also directly add properties to your project objects using properties files. You can place a gradle.properties file in the Gradle user home directory (defaults to USER_HOME/.gradle) or in your project directory. For multi-project builds you can place gradle.properties files in any subproject directory. The properties of the gradle.properties can be accessed via the project object. The properties file in the user's home directory has precedence over property files in the project directories.
Check for more details: http://www.gradle.org/docs/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:configurations%28groovy.lang.Closure%29
Add a gradle.properties file in the root directory of your project (same level as build.gradle) with this content:
version=0.0.1-SNAPSHOT

Resources