Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Create light weight jar from intellij


How to create jar without dependencies in intellij. I mean only jar with our main class instead of jar with all the dependencies are added to the main class jar. This way I am looking for light weight jar


@Mahendiran Palani Samy AFAIK by default intellij jars are built without the external jars (what you call light weight jar). To create a fat jar you need to add configuration, for example in maven: jar-with-dependencies - with sbt you need a plugin called sbt-assembly.



I could create the light weight jar following the below steps.

(i) Project Structure -> artifacts -> click the "+" symbol

(ii) Now go to JAR -> Empty -> <give name of the jar in "Name">

(iii) Now press "Apply" button

(iv) Now you can see the jar file created with the given name. On top of that we can see a "+" symbol

(v) Now select "Module output" and then select your project

(vi) Create Manifest if it is not available.

This way I created jar file with less than 125 KB. If I add all the dependencies it is coming around 300 MB.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.