Thursday, June 12, 2014

gradle note

1.
The left shift operator << is a shortcut for the action doLast.
task helloWorld {
doLast {
println 'Hello world!'
}
}
equals to
task helloWorld << {
println 'Hello world!'
}

2.
gradle -q tasks
gradle -q tasks --all
gradle -q helloWorld -> gradle -q hW
gradle -b ... Use this option to execute a build script with a different name other then build.gradle

3.
http://www.gradle.org/docs/current/dsl/index.html
jar{
exclude('**/*.properties')
}

4.
mavenLocal()
mavenCentral()
From http://www.gradle.org/docs/current/javadoc/index.html
DependencyHandler
   //declaring arbitrary files as dependencies
   compile files('hibernate.jar', 'libs/spring.jar')

   //putting all jars from 'libs' onto compile classpath
   compile fileTree('libs')
maven { url "http://cptrasv01:8081/nexus/content/groups/public/" }
    compile group: 'com.tdsecurities.stars.mdm', name: 'midas_common', version:'1.0.1-SNAPSHOT'

5. gradle plugin application does not work for inteactive console application even the below is added into the build.gradle
run{
    standardInput = System.in
}

6. Changing the project default layout
sourceSets {
main {
java {
srcDirs = ['src']
}
}
test {
java {
srcDirs = ['test']
}
}
}
buildDir = 'out'

7.
Using the wrapper is considered best practice and should be mandatory for every Gradle
project. Gradle scripts backed by the wrapper are perfectly prepared to run as part of
automated release processes like continuous integration and delivery.

No comments:

Post a Comment