• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to create a jar file for an eclipse project using maven

 
Ranch Hand
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I need to create a JAR file of my Java application that I have been running using eclipse. My application includes various libraries such as JOGL. jar, gluegen-rt.jar and more importantly embedded Java DB.
I want to know how I can create a JAR file for my application, using Maven, in eclipse? I did look at this link http://www.sonatype.com/books/m2eclipse-book/reference/ and http://maven.apache.org/plugins/maven-eclipse-plugin/usage.html , but nowhere has it been mentioned about how to create use an exixting Java application and include its dependencies for creating a JAR file using Maven.

Can anyone please suggest me how I can proceed? Thanks in advance....

Regards,
Sarah
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure I understand where you're having a hard time.
My suggestion would be to add a pom.xml and refactor your directory structure if needed to maven standards then build it.
Adding libraries is just a matter of resource tags in the pom.

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to start with a new project that is a Maven Project and move all of your code over to that project. And add you dependencies to the pom.xml. Once you have that done, look at the Maven Assembly Plugin documentation (http://maven.apache.org/plugins/maven-assembly-plugin/), specifically the assembly:single goal. That plugin will let you package everything into a single JAR file.
 
Brian Babbage
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:You need to start with a new project that is a Maven Project and move all of your code over to that project. And add you dependencies to the pom.xml. Once you have that done, look at the Maven Assembly Plugin documentation (http://maven.apache.org/plugins/maven-assembly-plugin/), specifically the assembly:single goal. That plugin will let you package everything into a single JAR file.



If you're using an IDE like eclipse you don't have to recreate the wheel. Make sure you have an eclipse m2 plugin and you can enable maven dependencies. Your classpath will change and you may have to adjust your buildpath dependencies etc. but you don't need to recreate everything which can be especially difficult if you're using subversion.

Then creating your pom (with all the gidgets and gadgets you need) should not be to terribly difficult.
 
Sarah Raf
Ranch Hand
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for the help
At the moment I am not using Maven. But the links and suggestions did help me a lot to learn about Maven. Thanks a lot once again

Regards,
Sarah
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic