Jar File By using gradle

(vamsikrishna) #1

Hello Every one, Can you help me in gradle build jar with all dependency jar(another project) and my project log4j2.xml file under src/main/java,

i was tried jar is getting but log4j2.xml file not there in that jar,

(Chris Doré) #2

log4j2.xml should be in src/main/resources.

Can you explain more about what you want to do with the dependency jar? Do you want to make a fat/shadow/shaded jar?

(vamsikrishna) #3

Yes,It working fine but i faces two Issues last one week in gradle ,

  1. org.gradle.internal.remote.internal.MessageIOException: Could not write ‘/’. while build time ,
    2,org.gradle.tooling.BuildException: Could not run build action using Gradle distribution ‘https://services.gradle.org/distributions/gradle-4.9-bin.zip’.

please Let me know,you have any idea,

(David Obber) #4

As Chris told you, log4j2.xml is a resource. I’ve never seen the error messages you described. But I just can tell you that I use the “shadow” plugin to build “executable jars” with all dependencies embedded in a fat jar.

Here’s a snippet from a gradle file

buildscript {
repositories {


dependencies {
    classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'


shadowJar {
archiveName = ‘myJar.jar’
classifier = ‘’

Hope this helps

(vamsikrishna) #5

Okay Thank you siaspa,