java - Gradle: Adding sources.jar file within /lib folder of published dist.zip along with all my other dependencies -
i have java project building using gradle. releasing dist.zip folder project , want add sources.jar project /lib subfolder within dist.zip. able create sources.jar file along dist.zip file not sure how add sources.jar within dist.zip. how can this? i've tried copy .jar /lib folder after creating unable work. below publishing , sourcesjar task within gradle.build script.
task sourcesjar(type: jar, dependson: classes) { classifier = 'sources' sourcesets.main.allsource } publishing { repositories { maven { url 'localfolder' } } publications { maven(mavenpublication) { groupid 'ca.project' artifactid applicationname version version components.java artifact sourcesjar { classifier "sources" } artifact distzip { classifier "dist" } } } }
you need tell application plugin include output of sourcesjar
task in distribution:
distributions { main { contents { sourcesjar } } }
that place in root, if want somewhere else can this:
distributions { main { contents { from(sourcesjar) { "lib" } } } }
Comments
Post a Comment