Run tasks on sub-projects only
./gradlew sub-project:build
Tasks
./gradlew classes
tasks
Gradle task options Skip Tasks
-x test -x testClasses -x javadoc -x javadocJar -x integrationTestClasses
-x findbugsMain -x findbugsTest -x findbugsIntegrationTest -x pmdMain -x pmdTest -x pmdIntegrationTest
--daemon
--dry-run
--profile
--parallel
Troubleshooting
--debug
-s, --stacktrace
Run specific tests
gradle test --tests org.gradle.SomeTest.someMethod
gradle test --tests org.gradle.SomeTest
gradle test --tests org.gradle.internal*
//select all ui test methods from integration tests by naming convention
gradle test --tests *IntegTest*ui*
//selecting tests from different test tasks
gradle test --tests *UiTest integTest --tests *WebTest*ui
Install an artifact locally
apply plugin: 'maven-publish'
gradle publishToMavenLocal
Using artifacts from local maven
apply plugin: "maven"
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
Run tasks in remote debug mode
--debug-jvm
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
- this is same as above, but more flexible.
gw - run gradle in sub folders
brew install gdub
Config files
Add extra steps into init script
~/.gradle/init.d
~/.gradle/init.gradle
allprojects {
apply plugin: 'maven-publish'
buildscript {
repositories {
mavenLocal()
....
}
}
repositories {
mavenLocal()
....
}
}
settings.gradle
- Figure out which projects are to take part in a build.
include ':repository', ':services', ':web-app'
gradle.properties vs settings.gradle
Change subproject name
include "foo"
rootProject.name = 'projectName'
project(":foo").name = "foofoo"
build.gradle
allprojects {}
subprojects {}
settings.gradle in root folder
build.gradle for each module
gradle.properties
Task
Use doLast instead of <<
task copyJarToBin(type: Copy) {
from createJar // shortcut for createJar.outputs.files
into "d:/tmp"
}
task stopTomcat(type:Exec)
Related
Maven Tips and Tricks - 2016
./gradlew sub-project:build
Tasks
./gradlew classes
tasks
Gradle task options Skip Tasks
-x test -x testClasses -x javadoc -x javadocJar -x integrationTestClasses
-x findbugsMain -x findbugsTest -x findbugsIntegrationTest -x pmdMain -x pmdTest -x pmdIntegrationTest
--daemon
--dry-run
--profile
--parallel
Troubleshooting
--debug
-s, --stacktrace
gradle test --tests org.gradle.SomeTest.someMethod
gradle test --tests org.gradle.SomeTest
gradle test --tests org.gradle.internal*
//select all ui test methods from integration tests by naming convention
gradle test --tests *IntegTest*ui*
//selecting tests from different test tasks
gradle test --tests *UiTest integTest --tests *WebTest*ui
Install an artifact locally
apply plugin: 'maven-publish'
gradle publishToMavenLocal
Using artifacts from local maven
apply plugin: "maven"
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
Run tasks in remote debug mode
--debug-jvm
export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
- this is same as above, but more flexible.
gw - run gradle in sub folders
brew install gdub
Config files
Add extra steps into init script
~/.gradle/init.d
~/.gradle/init.gradle
apply plugin: 'maven-publish'
buildscript {
repositories {
mavenLocal()
....
}
}
repositories {
mavenLocal()
....
}
}
settings.gradle
- Figure out which projects are to take part in a build.
include ':repository', ':services', ':web-app'
gradle.properties vs settings.gradle
Change subproject name
include "foo"
rootProject.name = 'projectName'
project(":foo").name = "foofoo"
build.gradle
allprojects {}
subprojects {}
settings.gradle in root folder
build.gradle for each module
gradle.properties
Cache
~/.gradle/caches, it can also be configured to use local or remote maven.Use doLast instead of <<
task copyJarToBin(type: Copy) {
from createJar // shortcut for createJar.outputs.files
into "d:/tmp"
}
task stopTomcat(type:Exec)
Related
Maven Tips and Tricks - 2016