Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Adding jndi.properties to 'Class-Path:' in generated jar file

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

I am trying to generate a jar file in Maven2 with a jndi.properties file included the Class-Path manifest attribute. The Class-Path attribute also needs to reference all the dependent jar files (which I am currently doing using <addClasspath>true</addClasspath> , but I can't seem to get both.

Is there a way to do this using Maven?
 
J Rosetto
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note, the reason I want to do it like this, rather than putting it into /resources (which will package it into my jar), is that I want to keep the jndi.properties outside my jar file so that it can be easily edited.
 
Saloon Keeper
Posts: 24334
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if I read that correctly, but here's a stab:

If you produce an executable JAR, all the resources (classes, property files, images, etc.) in that JAR will be placed in the app's CLASSPATH when you run the jar with the "java -jar jarfile" option.

Libraries, however, will not. They'll be visible on the classpath, but the app can't load or use their contents.

Fortunately, someone - or maybe several someones - have realized that this is a problem and that Maven can fix it. I haven't yet got the process all worked out, but apparently there's a Maven plug-in that can cause a custom classloader to be integrated into your app that peers inside the JARS and adds their contents to the classpath.
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic