Can someone tell me best practice for when there are a lot of jar dependencies for a webapp (war/ear/ejb)? My ear file takes 30 seconds to build because of all the jars. Can I put the dependencies into the app servers lib directory so that i dont have to package them in the ear file? i use maven's <scope> to indicate 'included' but when i build my ear from eclipse it ignores that scope, but thats another issue. My main question is, is there an alternative to bundling all the dependencies in a war file each time I deploy ?
A 30 second build isn't excessive for a big application. Do you know where the time is going? It could be "real" or an artificial slowness. For example, you could speed things up by being more incremental about what you do in the build.
While you could put the jars outside the jar, it introduces configuration management problems and I wouldn't recommend it.
Yeah; 30 seconds shouldn't be an issue--consider what's being done.
Joined: Mar 23, 2010
David Newton wrote:Yeah; 30 seconds shouldn't be an issue--consider what's being done.
Sorry, I should have been more specific as to what i am doing; During development, to test my changes, I publish via WTP to the app server. this is what's taking 30 seconds (creating the ear file with all those jars) .. I like to test in small increments, so I find I wait a lot..
I was looking for a shortcut during the development stage. A 30 second build for sit/uat/pat/prod would actually be a blessing :)
author & internet detective
It is extremely perilous to put application jars in the common directory of a webapp server. The code and resources in them may not have been designed for the uniquely stressful situation where multiple threads are accessing them through different classpaths.
As Jeanne pointed out, you can save the time spent on jarring everything up if your appserver supports exploded WAR/EAR files. In fact, some appservers will do you an even bigger favor and run exploded WARs straight from your project directory's build area, eliminating the need to copy the exploded EAR to the appservers directories (or to build straight into the appserver).
Tomcat is one of the above, and I've used that feature for years.
An IDE is no substitute for an Intelligent Developer.