I intend to generalize the use of gradle for my projects and would like to reuse the same build file everywhere. Unfortunately, I have trouble trying to define the properties mentioned in $subject in a single file, in order to ease the migration.
This is gradle 1.6.
What I have tried, failing at all attempts:
gradle.properties
: cannot modify name (read only, have to use a settings.gradle
and override the root project name!); {source,target}Compatibility
not taken into account;settings.gradle
: {source,target}Compatibility
not taken into account either!So, what is the correct method to achieve this? What I have tried so far in gradle.properties
:
group = something name = whatever # cannot do! version = whatever sourceCompatibility = whatever # not taken into account!
And in settings.gradle
:
sourceCompatibility = "whatever"; # not taken into account!
EDIT Well, the "name" problem just cannot be solved; for the rest, I have used another file which I apply in the build file. The "name" handling really isn't right :/
EDIT 2 This is now 2014 and gradle 1.12, and the problem still is not solved...
By default, Gradle uses the directory name as project name. You can change this by creating a settings. gradle file in the directory which specifies the project name. You can also add a description to your project via the build.
If you want to change the project name (which is kind of a separate question), you can do so in settings. gradle (e.g. rootProject.name = "something" ). Important: Setting the project name in settings. gradle (e.g. rootProject.name = "org.
gradle.properties:
theGroup=some.group theName=someName theVersion=1.0 theSourceCompatibility=1.6
settings.gradle:
rootProject.name = theName
build.gradle:
apply plugin: "java" group = theGroup version = theVersion sourceCompatibility = theSourceCompatibility
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With