eastwater
eastwater

Reputation: 5610

gradle: why there is no jar task for all sourceSets

Added sourceSet web, but there is no corresponding tasks for it:

apply plugin: 'java'
sourceSets {
    web
}

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
webClasses - Assembles web classes.

I expected the following task

webJar

Gradle assemble and build: does not build web sourceSet.

Upvotes: 0

Views: 1309

Answers (1)

Rene Groeschke
Rene Groeschke

Reputation: 28653

there's not a jar task per sourceSet because in most projects this jar is not required. For example the java project comes with two sourceSets (main and test). A jar for the test sourceSet is not needed as you can run the tests without it.

If you need a jar for your additional sourceSet you can easily create one:

task myJar(type:Jar){
    from sourceSets.mySourceSet.output  
}

Upvotes: 2

Related Questions