0

This is my first Question on Stackoverflow, so please be easy on me. I am trying to figure out a way to have all my .jar files in one dedicated folder so they can be accessed by different applications. This includes web services. Mainly I am looking for a clean way to have one dedicated Folder on a machine where i can exchange .jar files wich then are used by other .jars as well as web services.

Currently i build .jars and deploy those into .war files and then have tomcat deploy those as webservices. This works but is quite unpractical. What i would really love to have is a way to change .jar Files in one folder not having to recompile and redistribute my .war files.

Basically i would need a way to set my primary classpath so that .war and .jar files always pull classes they depend upon from one dedicated folder.

Is this possible? Or rather... is this possible in a sensible way?

dekiri
  • 1
  • 1
  • Building with Maven might be a sensible solution - central repository for your jars... – Mechkov Feb 04 '15 at 21:48
  • Thanks, I read about Maven, so that answer does not surprise me much, but does it also work with .war files ? – dekiri Feb 04 '15 at 21:50
  • When building your war you can add copy task so it will move / copy your latest build o a given folder. What tool do you use to build your war file? – MaxZoom Feb 04 '15 at 21:51
  • I usually build the war file with netbeans and then copy it to the appropiate dist folder in my tomcat server. I thought it might be possible to maybe set a classpath in the Manifest.mf that points to a specific folder on my machine in all my .jars. The problem with copy would still be that i would be forced to rebuild the .war again and distribute it wouldn't it ? – dekiri Feb 04 '15 at 21:55
  • @dekiri Building with Maven allows you to deploy as a war file as well. – Mechkov Feb 04 '15 at 22:21
  • Another solution is to use [gradle](http://gradle.org) – fge Feb 04 '15 at 22:23
  • Maven, Gradle, Ant et al will not help you here. They embed the jar files in the War file in the WEB-INF/lib dir which will not allow you to change a given library without rebuilding the war file (since that's how war files work). It sounds like you want a plugin system, in which case there are a few options here - http://stackoverflow.com/questions/465099/best-way-to-build-a-plugin-system-with-java – stringy05 Feb 04 '15 at 23:04

0 Answers0