How do I create an executable fat jar with Gradle with implementation dependencies

Dmitry Senkovich
:

I've got a simple project in Gradle 4.6 and would like to make an executable jar of it. I've tried shadow, gradle-fatjar-plugin, gradle-one-jar, spring-boot-gradle-plugin plugins but neither of them adds my dependencies declared as implementation (I don't have any compile ones). It works with compile e.g. for gradle-one-jar plugin but I would like to have implementation dependencies.

Thank you very much!

miskender
:

You can use the following code.

jar {
    manifest {
        attributes(
                'Main-Class': 'com.package.YourClass'
        )
    }
    from {
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
 }

Be sure to replace com.package.YourClass with the fully qualified class name containing static void main( String args[] ).

This will pack the runtime dependencies. Check the docs if you need more info.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I create an executable fat jar with Gradle with implementation dependencies

From Dev

How do I create a jar with all dependencies using Gradle 4.4?

From Dev

How do I create an executable jar file including dependencies where the main class is in Test, using Maven

From Java

How can I create an executable JAR with dependencies using Maven?

From Dev

How to create executable JAR with Gradle?

From Dev

I used gradle to build a fat jar with all of my dependencies included in it. Now, when using distZip, how do I exclude these jar files?

From Dev

How can I create single executable jar in my gradle project

From Dev

How do I publish a fat JAR (JAR with dependencies) using sbt and sbt-release?

From Dev

Gradle: Build 'fat jar' with Spring Boot Dependencies

From Dev

How do you create then run an executable jar with dependencies in Intellij IDEs, specifically Android Studio?

From Dev

How do I tell Gradle to include a local library jar that in turn has dependencies?

From Dev

How do I create an executable JAR file from my intellij project?

From Dev

gradle executable jar can't include local jar dependencies

From Dev

How do I check jar file dependencies

From Dev

How do I create a Netbeans style Jar with all dependencies in a lib folder?

From Dev

Can't understand gradle jar task code that creates executable fat-jar

From Dev

How do I mark a .jar file as executable on Xubuntu 13.04?

From Dev

Maven and Netbeans: how do I build project and get executable jar?

From Dev

How do I mark a .jar file as executable on Xubuntu 13.04?

From Dev

How the heck do I make jar files executable?

From Dev

Spring Boot + Gradle: how to build executable jar

From Dev

How do I include RTI nddsjava library in a jar with dependencies?

From Dev

How do I export a JavaFX Application and dependencies in the same jar in Intellij?

From Dev

Using maven assembly plugin to create ZIP file containing a fat jar (jar-with-dependencies)

From Dev

How do I create an uber jar in Ceylon

From Dev

How do I create a .jar with a databse?

From Dev

How can I produce a Crystal executable with no dependencies?

From Dev

How to run Gradle JAR against local dependencies?

From Dev

how do I create a stand-alone executable with perl 6?

Related Related

  1. 1

    How do I create an executable fat jar with Gradle with implementation dependencies

  2. 2

    How do I create a jar with all dependencies using Gradle 4.4?

  3. 3

    How do I create an executable jar file including dependencies where the main class is in Test, using Maven

  4. 4

    How can I create an executable JAR with dependencies using Maven?

  5. 5

    How to create executable JAR with Gradle?

  6. 6

    I used gradle to build a fat jar with all of my dependencies included in it. Now, when using distZip, how do I exclude these jar files?

  7. 7

    How can I create single executable jar in my gradle project

  8. 8

    How do I publish a fat JAR (JAR with dependencies) using sbt and sbt-release?

  9. 9

    Gradle: Build 'fat jar' with Spring Boot Dependencies

  10. 10

    How do you create then run an executable jar with dependencies in Intellij IDEs, specifically Android Studio?

  11. 11

    How do I tell Gradle to include a local library jar that in turn has dependencies?

  12. 12

    How do I create an executable JAR file from my intellij project?

  13. 13

    gradle executable jar can't include local jar dependencies

  14. 14

    How do I check jar file dependencies

  15. 15

    How do I create a Netbeans style Jar with all dependencies in a lib folder?

  16. 16

    Can't understand gradle jar task code that creates executable fat-jar

  17. 17

    How do I mark a .jar file as executable on Xubuntu 13.04?

  18. 18

    Maven and Netbeans: how do I build project and get executable jar?

  19. 19

    How do I mark a .jar file as executable on Xubuntu 13.04?

  20. 20

    How the heck do I make jar files executable?

  21. 21

    Spring Boot + Gradle: how to build executable jar

  22. 22

    How do I include RTI nddsjava library in a jar with dependencies?

  23. 23

    How do I export a JavaFX Application and dependencies in the same jar in Intellij?

  24. 24

    Using maven assembly plugin to create ZIP file containing a fat jar (jar-with-dependencies)

  25. 25

    How do I create an uber jar in Ceylon

  26. 26

    How do I create a .jar with a databse?

  27. 27

    How can I produce a Crystal executable with no dependencies?

  28. 28

    How to run Gradle JAR against local dependencies?

  29. 29

    how do I create a stand-alone executable with perl 6?

HotTag

Archive