build.gradle - How to generate multiple jar files with gradle's java plugin -
i have multi-project gradle build using java plugin setup follows:
myproj/ settings.gradle build.gradle util/ build.gradle
in util project, generate 2 jars... 1 packagea , 1 packageb. i'm noob gradle here appreciated. here settings , gradle files:
myproj/settings.gradle
include 'util'
myproj/build.gradle
subprojects { apply plugin: 'java' repositories { maven { url "http://mymavenurl" } } sourcesets { main { java { srcdir 'src/java' } } } }
myproj/util/build.gradle
dependencies { . . . } jar { basename = 'packagea' includes = ['com/mycomp/packagea'] } task packagebjar(type: jar) { dependson classes includes = ['com/mycomp/packageb'] basename = 'packageb' }
when try build project here output:
:util:compilejava :util:processresources up-to-date :util:classes :util:jar :util:assemble :util:compiletestjava up-to-date :util:processtestresources up-to-date :util:testclasses up-to-date :util:test :util:check :util:build
i hope see :util:packagebjar after classes, i'm not having luck.
one way declare packagebjar
artifact of, say, archives
configuration:
artifacts { archives packagebjar }
now gradle assemble
, , therefore gradle build
, produce packagebjar
.
Comments
Post a Comment