How to set the project name/group/version, plus {source,target} compatibility in the same file?

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:

  • 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

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...


settings.gradle: = theName


apply plugin: "java"

group = theGroup
version = theVersion
sourceCompatibility = theSourceCompatibility

I found the solution to a similar problem. I am using Gradle 1.11 (as April, 2014). The project name can be changed directly in settings.gradle file as following:'YourNewName'

This takes care of uploading to repository (Artifactory w/ its plugin for me) with the correct artifactId.

I set the artifact baseName so it is independent of the build project name, which allows me to achieve what you want:

jar {
    baseName "core"

With this property set, even if my project name is "foo", when I run gradle install, the artifact is published with the name core instead of foo.

Apparently this would be possible in settings.gradle with something like this. = 'someName'
gradle.rootProject {
    it.sourceCompatibility = '1.7'

I recently received advice that a project property can be set by using a closure which will be called later when the Project is available.

use buildSrc with Gradle Kotlin DSL see full worked example here: GitHub daggerok/spring-fu-jafu-example buildSrc/src/main/java/Globals.kt

Need Your Help

jQuery UI Modal Dialog Stripe Issue

jquery css jquery-ui modal-dialog

I have this extremely basic jQuery UI Modal Dialog that I wrote for testing here. Unless I am missing something I cannot figure out why their is that grey strip across the middle of the page. I am