Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problems in making an executable jar file thru Maven

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I'm trying to make an executable jar file thru maven, but I'm getting this error :





Here is my pom.xml file





I have checked the contents of the Manifest file and it does seem to be correct. Please let me know if any one has any idea about whats happening :-?

 
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 are looking at the wrong JAR file. The JAR file you are looking at is described by the JAR plugin in lines 68-79.

Your POM doesn't have any execution entry for the assembly plugin. Did you remember to pass assembly:single on the build command line? If not, the assembly plugin will not have run. If that goal does get run you will have a JAR name bls-inquiry-tracking-1.0-jar-with-dependencies.jar, that's you one you want to run.
 
Ankit V Agrawal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter, thanks for the reply. Yes I made a mistake and did not give any execution in the pom.
I have modified the pom. Now I'm getting 3 jars.

bls-inquiry-tracking-1.0-SNAPSHOT-jar-with-dependencies.jar
bls-inquiry-tracking-1.0-SNAPSHOT-sources.jar
bls-inquiry-tracking-1.0-SNAPSHOT.jar

The MF file in the 1st jar is
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.5.0_12-b04 (Sun Microsystems Inc.)

And when I try to run it I get the following error :
C:\projects\bls-inquiry-tracking\target>java -jar bls-inquiry-tracking-1.0-SNAPSHOT-jar-with-dependencies.jar
Failed to load Main-Class manifest attribute from
bls-inquiry-tracking-1.0-SNAPSHOT-jar-with-dependencies.jar


The Mf file of bls-inquiry-tracking-1.0-SNAPSHOT.jar is still the same as what was in my previous post.

Here is my modified pom.xml


 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You never identified a main class for the jar-with-dependencies jar. Use the archive parameter to set that up - copy lines 76-81 to after line 89.
 
Ankit V Agrawal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Peter, that was exactly the problem. I followed what you mentioned and the problem is resolved. Thank you so much !
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic