Osanda Deshan
Osanda Deshan

Reputation: 1559

How to deploy my maven project as a jar file which will take its dependencies using a pom file?

I have seen many threads regarding deploying a jar file for maven projects. But I am having different requirements.

  1. I don't have a main class in my maven project.
  2. I have some dependencies in my pom.xml file.
  3. I need to deploy a jar file with less size which can take the dependencies through its pom file. (I am currently deployed jar with dependencies using IntelliJ IDEA, now it is 56 MB. I need it to be less capacity, using the above way or an alternative way)

Thank you.

Upvotes: 1

Views: 1389

Answers (3)

Osanda Deshan
Osanda Deshan

Reputation: 1559

I have finally find the solution for this. As @JF Meier explained mvn clean install does the job. But before that I had to move to the step definitions which was inside the test packages. Actually those step definitions are not belongs to the test package since it won't test my project.

Thanks All.

Upvotes: 1

Bipil Raut
Bipil Raut

Reputation: 262

Please try below steps :- Hope so its will be help you pack200 can drastically reduce the JAR size. heck your dependencies via:

mvn dependency:analyze

or take a look at the dep tree like this:

mvn dependency:tree

do you have unused dependencies?if yes Remove the unused dependency in pom.xml file.

Upvotes: 1

J Fabian Meier
J Fabian Meier

Reputation: 35805

When you build a jar with maven (like clean install or clean deploy), the jar:

  1. does not need to have the main class
  2. uses the dependencies in the pom.xml
  3. does not bundle external dependencies into that unless you specifically tell it to

So your requirements seem to be met automatically.

Upvotes: 1

Related Questions