wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes can we create a jar file of package using maven? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "can we create a jar file of package using maven?" Watch "can we create a jar file of package using maven?" New topic
Author

can we create a jar file of package using maven?

Gourav Gupta
Greenhorn

Joined: Dec 27, 2013
Posts: 19
Please help me to create a jar file of a package only using maven plug in.
Vyacheslav Petc
Greenhorn

Joined: Nov 17, 2013
Posts: 4
Apparently, you should execute command: mvn package
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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.


JBoss In Action
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11432
    
  85

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.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
jQuery in Action, 2nd edition
 
subject: can we create a jar file of package using maven?