Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we create a jar file of package using maven?

 
Gourav Gupta
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me to create a jar file of a package only using maven plug in.
 
Vyacheslav Petc
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently, you should execute command: mvn package
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of project do you have? if a web app project, you will not get a JAR file, only a WAR file. If you have a non-web project you will get a JAR file but it will contain all classes in your project (in other words, all classes in all packages.)

If Vyachestav's answer didn't help, if you could be more specific on what you are trying to accomplish, and what you project looks like, we can provide a better answer.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11887
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the package command only packages up your distributable files, not the packages you depend on.

Normally this is a good thing - your files are the ones that are likely to change, while the dependencies change rarely. Therefore only packaging your jar (or war) file means that you have a smaller jar or war for you to copy to wherever you need it to live.

However it is possible that you want to have a jar file that contains within it not only all of your distributable files, but all the distributable files from your dependencies. In this case you should probably look at the Maven Assembly plugin.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic