Gradle, create and copy javadoc jars from multiple dependencies -
i have following project structure:
- project 1
- project 2 depends on project 1
- project 3 depends on project 1
(there external dependencies)
i create source jars , javadoc jars with
task sourcesjar(type: jar) { destinationdir = file("./../../build/export/$project.name") classifier 'sources' sourcesets.main.allsource } task javadocjar(type: jar, dependson: javadoc) { destinationdir = file("./../../build/export/$project.name") classifier 'javadoc' javadoc.destinationdir } artifacts { archives sourcesjar archives javadocjar }
now need create folder contains jar file of project , jar files of dependencies. current version is
task makelibsdir(type: copy, dependson: ['jar', 'sourcesjar', 'javadocjar']) { description 'builds relevant jar files use project dependency , copies them libs folder' jar // copying jar configuration file outdir = file("./../../build/$project.name/libs/") outdir.mkdirs() outdir into('/') { configurations.runtime } }
when call project2:makelibsdir folder contains
project1.jar project2.jar extdept1.jar ...
but there 2 problems
- sources jar , javadoc jar project1 not build
- sources jar , javadoch jar project2 build, not copied libs folder
any idea how can
- ensure jars dependent projects build
- copy them final location
edit: minimized version of full build.gradle
builddir = "../build/$project.name" subprojects { apply plugin: 'java' apply plugin: 'application' apply plugin: 'eclipse' repositories { mavencentral() } sourcesets { .... } jar { destinationdir = file("./../../build/export/$project.name") destinationdir.mkdirs() basename = project.name } task makelibsdir(type: copy, dependson: ['jar', 'sourcesjar', 'javadocjar']) { jar file outdir = file("./../../build/$project.name/libs/") outdir.mkdirs() outdir into('/') { configurations.runtime } } task sourcesjar(type: jar) { destinationdir = file("./../../build/export/$project.name") classifier 'sources' sourcesets.main.allsource } task javadocjar(type: jar, dependson: javadoc) { destinationdir = file("./../../build/export/$project.name") classifier 'javadoc' javadoc.destinationdir } artifacts { archives sourcesjar archives javadocjar } project(':project1') { dependencies { ... } } project(':project2') { dependencies { ... compile project(':project1') } } project(':project2') { dependencies { ... compile project(':project1') } } }
Comments
Post a Comment