Gradle: package multi-project into a single jar
I have a gradle multi-project and want to create a single jar (library) containing all the classes of my subprojects and external dependencies.
I have the following project structure. Each project has its own 3rd party dependencies. Common dependencies are included in the root project. The two modules A and B are dependent on the core.
+ root-project (only build.gradle and settings.gradle)
- core (src/main/java, src/main/resources, ..)
- module-A (src/main/java, src/main/resources, ..)
- module-B (src/main/java, src/main/resources, ..)
To export a single jar, I added the following task to the build.gradle of the root project:
apply plugin: "java"
subprojects.each { subproject -> evaluationDependsOn(subproject.path)}
task allJar(type: Jar, dependsOn: subprojects.jar) {
baseName = 'multiproject-test'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
}
artifacts {
archives allJar
}
This approach works, but does only collect the project source files. The 3rd party dependencies are ignored. So I tried out the Shadow Plugin (http://imperceptiblethoughts.com/shadow/) which should also include external dependencies.
Unfortunately the plugin does not collect anything at all. This is most probably due to missing dependencies between the root project and its sub projects. How can I tell the shadow plugin, that it should collect the sources of the subprojects? Or is there a better approach to export a single library out of multiple projects?
complete build.gradle using the shadow plugin:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.test.multi-project'
version = '1.0'
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
apply plugin: "java"
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
mavenCentral()
}
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single jar out of all sub projects
****************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
shadowJar {
baseName = 'multiproject-test'
}
The submodules are included in the settings.gradle of the root project
rootProject.name = 'myproject-root'
// submodules
include ":core"
include ":module-A"
include ":module-B"
Thanks for your help!
gradle fatjar
add a comment |
I have a gradle multi-project and want to create a single jar (library) containing all the classes of my subprojects and external dependencies.
I have the following project structure. Each project has its own 3rd party dependencies. Common dependencies are included in the root project. The two modules A and B are dependent on the core.
+ root-project (only build.gradle and settings.gradle)
- core (src/main/java, src/main/resources, ..)
- module-A (src/main/java, src/main/resources, ..)
- module-B (src/main/java, src/main/resources, ..)
To export a single jar, I added the following task to the build.gradle of the root project:
apply plugin: "java"
subprojects.each { subproject -> evaluationDependsOn(subproject.path)}
task allJar(type: Jar, dependsOn: subprojects.jar) {
baseName = 'multiproject-test'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
}
artifacts {
archives allJar
}
This approach works, but does only collect the project source files. The 3rd party dependencies are ignored. So I tried out the Shadow Plugin (http://imperceptiblethoughts.com/shadow/) which should also include external dependencies.
Unfortunately the plugin does not collect anything at all. This is most probably due to missing dependencies between the root project and its sub projects. How can I tell the shadow plugin, that it should collect the sources of the subprojects? Or is there a better approach to export a single library out of multiple projects?
complete build.gradle using the shadow plugin:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.test.multi-project'
version = '1.0'
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
apply plugin: "java"
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
mavenCentral()
}
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single jar out of all sub projects
****************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
shadowJar {
baseName = 'multiproject-test'
}
The submodules are included in the settings.gradle of the root project
rootProject.name = 'myproject-root'
// submodules
include ":core"
include ":module-A"
include ":module-B"
Thanks for your help!
gradle fatjar
add a comment |
I have a gradle multi-project and want to create a single jar (library) containing all the classes of my subprojects and external dependencies.
I have the following project structure. Each project has its own 3rd party dependencies. Common dependencies are included in the root project. The two modules A and B are dependent on the core.
+ root-project (only build.gradle and settings.gradle)
- core (src/main/java, src/main/resources, ..)
- module-A (src/main/java, src/main/resources, ..)
- module-B (src/main/java, src/main/resources, ..)
To export a single jar, I added the following task to the build.gradle of the root project:
apply plugin: "java"
subprojects.each { subproject -> evaluationDependsOn(subproject.path)}
task allJar(type: Jar, dependsOn: subprojects.jar) {
baseName = 'multiproject-test'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
}
artifacts {
archives allJar
}
This approach works, but does only collect the project source files. The 3rd party dependencies are ignored. So I tried out the Shadow Plugin (http://imperceptiblethoughts.com/shadow/) which should also include external dependencies.
Unfortunately the plugin does not collect anything at all. This is most probably due to missing dependencies between the root project and its sub projects. How can I tell the shadow plugin, that it should collect the sources of the subprojects? Or is there a better approach to export a single library out of multiple projects?
complete build.gradle using the shadow plugin:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.test.multi-project'
version = '1.0'
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
apply plugin: "java"
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
mavenCentral()
}
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single jar out of all sub projects
****************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
shadowJar {
baseName = 'multiproject-test'
}
The submodules are included in the settings.gradle of the root project
rootProject.name = 'myproject-root'
// submodules
include ":core"
include ":module-A"
include ":module-B"
Thanks for your help!
gradle fatjar
I have a gradle multi-project and want to create a single jar (library) containing all the classes of my subprojects and external dependencies.
I have the following project structure. Each project has its own 3rd party dependencies. Common dependencies are included in the root project. The two modules A and B are dependent on the core.
+ root-project (only build.gradle and settings.gradle)
- core (src/main/java, src/main/resources, ..)
- module-A (src/main/java, src/main/resources, ..)
- module-B (src/main/java, src/main/resources, ..)
To export a single jar, I added the following task to the build.gradle of the root project:
apply plugin: "java"
subprojects.each { subproject -> evaluationDependsOn(subproject.path)}
task allJar(type: Jar, dependsOn: subprojects.jar) {
baseName = 'multiproject-test'
subprojects.each { subproject ->
from subproject.configurations.archives.allArtifacts.files.collect {
zipTree(it)
}
}
}
artifacts {
archives allJar
}
This approach works, but does only collect the project source files. The 3rd party dependencies are ignored. So I tried out the Shadow Plugin (http://imperceptiblethoughts.com/shadow/) which should also include external dependencies.
Unfortunately the plugin does not collect anything at all. This is most probably due to missing dependencies between the root project and its sub projects. How can I tell the shadow plugin, that it should collect the sources of the subprojects? Or is there a better approach to export a single library out of multiple projects?
complete build.gradle using the shadow plugin:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'com.test.multi-project'
version = '1.0'
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
apply plugin: "java"
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
mavenCentral()
}
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single jar out of all sub projects
****************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
shadowJar {
baseName = 'multiproject-test'
}
The submodules are included in the settings.gradle of the root project
rootProject.name = 'myproject-root'
// submodules
include ":core"
include ":module-A"
include ":module-B"
Thanks for your help!
gradle fatjar
gradle fatjar
asked Feb 20 '18 at 14:51
Public VoidPublic Void
619
619
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
I solve my problem with the solution explained here: https://discuss.gradle.org/t/how-to-get-gradle-install-to-actually-bundle-all-project-subproject-classes-resources-etc/12070/4
My build.gradle looks now like this:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
repositories {
mavenCentral()
}
group = 'com.test.multiproject'
version = '1.0'
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
// common dependencies
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single library jar containing all sub projects and 3rd party dependencies
****************************************/
configurations {
childJars
}
dependencies {
subprojects.each {
childJars project(it.path)
}
}
jar {
dependsOn configurations.childJars
from { configurations.childJars.collect { zipTree(it) } }
}
add a comment |
What about something simple like that :
task fatJar(type: Jar) {
subprojects.each { subproject ->
from subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
add a comment |
How about getting all runtime libs while building jar itself
jar {
archiveName 'Some.jar'
manifest {
attributes 'Implementation-Title': 'Some',
'Plugin-Class': 'main'
}
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it)}}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48887980%2fgradle-package-multi-project-into-a-single-jar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I solve my problem with the solution explained here: https://discuss.gradle.org/t/how-to-get-gradle-install-to-actually-bundle-all-project-subproject-classes-resources-etc/12070/4
My build.gradle looks now like this:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
repositories {
mavenCentral()
}
group = 'com.test.multiproject'
version = '1.0'
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
// common dependencies
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single library jar containing all sub projects and 3rd party dependencies
****************************************/
configurations {
childJars
}
dependencies {
subprojects.each {
childJars project(it.path)
}
}
jar {
dependsOn configurations.childJars
from { configurations.childJars.collect { zipTree(it) } }
}
add a comment |
I solve my problem with the solution explained here: https://discuss.gradle.org/t/how-to-get-gradle-install-to-actually-bundle-all-project-subproject-classes-resources-etc/12070/4
My build.gradle looks now like this:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
repositories {
mavenCentral()
}
group = 'com.test.multiproject'
version = '1.0'
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
// common dependencies
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single library jar containing all sub projects and 3rd party dependencies
****************************************/
configurations {
childJars
}
dependencies {
subprojects.each {
childJars project(it.path)
}
}
jar {
dependsOn configurations.childJars
from { configurations.childJars.collect { zipTree(it) } }
}
add a comment |
I solve my problem with the solution explained here: https://discuss.gradle.org/t/how-to-get-gradle-install-to-actually-bundle-all-project-subproject-classes-resources-etc/12070/4
My build.gradle looks now like this:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
repositories {
mavenCentral()
}
group = 'com.test.multiproject'
version = '1.0'
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
// common dependencies
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single library jar containing all sub projects and 3rd party dependencies
****************************************/
configurations {
childJars
}
dependencies {
subprojects.each {
childJars project(it.path)
}
}
jar {
dependsOn configurations.childJars
from { configurations.childJars.collect { zipTree(it) } }
}
I solve my problem with the solution explained here: https://discuss.gradle.org/t/how-to-get-gradle-install-to-actually-bundle-all-project-subproject-classes-resources-etc/12070/4
My build.gradle looks now like this:
/****************************************
* instructions for all projects
****************************************/
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
repositories {
mavenCentral()
}
group = 'com.test.multiproject'
version = '1.0'
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
/****************************************
* instructions for each sub project
****************************************/
subprojects {
// common dependencies
dependencies {
compile "org.slf4j:slf4j-api:1+"
compile "ch.qos.logback:logback-core:1+"
compile "ch.qos.logback:logback-classic:1+"
testCompile "junit:junit:4+"
}
}
/****************************************
* Single library jar containing all sub projects and 3rd party dependencies
****************************************/
configurations {
childJars
}
dependencies {
subprojects.each {
childJars project(it.path)
}
}
jar {
dependsOn configurations.childJars
from { configurations.childJars.collect { zipTree(it) } }
}
answered Feb 21 '18 at 7:59
Public VoidPublic Void
619
619
add a comment |
add a comment |
What about something simple like that :
task fatJar(type: Jar) {
subprojects.each { subproject ->
from subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
add a comment |
What about something simple like that :
task fatJar(type: Jar) {
subprojects.each { subproject ->
from subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
add a comment |
What about something simple like that :
task fatJar(type: Jar) {
subprojects.each { subproject ->
from subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
What about something simple like that :
task fatJar(type: Jar) {
subprojects.each { subproject ->
from subproject.configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
answered Feb 20 '18 at 16:57
ToYonosToYonos
11.9k22849
11.9k22849
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
add a comment |
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Thanks for your reply. I need to add doLast { subprojects.each ... } to get it work. But the generated jar only contains the manifest file. Do you see what I am doing wrong? I'm still pretty new to gradle.
– Public Void
Feb 20 '18 at 17:16
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
Why doesn't it work without the doLast ?
– ToYonos
Feb 20 '18 at 19:05
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
If I add the fatJar Task directly in the build.gradle of the root project (no nesting within allprojects{} or subprojects{}), the generated jar only contains the manifest. I also tried the solution explained here: discuss.gradle.org/t/…. Even though this approach works, it creates a complement jar in each subfolder and therefore takes quite a while to build. I don't thing that this is the way to go. So I'm still looking for a better one.
– Public Void
Feb 20 '18 at 21:11
add a comment |
How about getting all runtime libs while building jar itself
jar {
archiveName 'Some.jar'
manifest {
attributes 'Implementation-Title': 'Some',
'Plugin-Class': 'main'
}
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it)}}
}
add a comment |
How about getting all runtime libs while building jar itself
jar {
archiveName 'Some.jar'
manifest {
attributes 'Implementation-Title': 'Some',
'Plugin-Class': 'main'
}
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it)}}
}
add a comment |
How about getting all runtime libs while building jar itself
jar {
archiveName 'Some.jar'
manifest {
attributes 'Implementation-Title': 'Some',
'Plugin-Class': 'main'
}
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it)}}
}
How about getting all runtime libs while building jar itself
jar {
archiveName 'Some.jar'
manifest {
attributes 'Implementation-Title': 'Some',
'Plugin-Class': 'main'
}
from {configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it)}}
}
answered Nov 26 '18 at 6:09
Kestas KKKestas KK
62
62
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48887980%2fgradle-package-multi-project-into-a-single-jar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown