• 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

Maven, war dependencies, and moving files around

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got a common "stub" war that I don't intend to deploy, but which I intend to use as a dependency in one or more other deployable wars. I have files in the dependency in a directory foo/bar/ that I'd like to wind up in the deployable war under directory baz/ (relative to the base directory).

In maven 2.0.9, I'm able to get the dependency to overlay on the packaged war via:

However, the included files wind up in baz/foo/bar/ instead of baz/. Is there some way to do a war overlay using <targetPath> and strip the original directory path simultaneously? This seems like a common-enough problem that there's likely to be a widely available way to do it, but the solution escapes me.

Am I using the wrong plugin? I've also tried various combinations of maven-assembly-plugin and maven-dependency-plugin with no success thus far.

Many thanks in advance.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Damon and welcome to Javaranch!

I confess I'm a little confused by your use case. Are you saying that you've got a common (stub) WAR that your other WARs are dependent on? I assume in your deploy directory it looks like this:

<app server dir structure>/deploy/stub.war
<app server dir structure>/deploy/y_is_reliant_on_stub.war
<app server dir structure>/deploy/x_is_reliant_on_stub.war

Is that right?
 
Damon Silver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:Hi Damon and welcome to Javaranch!

I confess I'm a little confused by your use case. Are you saying that you've got a common (stub) WAR that your other WARs are dependent on? I assume in your deploy directory it looks like this:

<app server dir structure>/deploy/stub.war
<app server dir structure>/deploy/y_is_reliant_on_stub.war
<app server dir structure>/deploy/x_is_reliant_on_stub.war

Is that right?



Not quite. I'd like to have stub.war be packaged already and available at compilation/packaging time when y_is_reliant_on_stub.war and x_is_reliant_on_stub.war are built, then deploy those two but not stub.war. Essentially, stub.war contains JSP's and JSP fragments that are common to several deployable wars. I need each of those wars to have the common bits available without having to deploy stub.war itself, since it won't work in absentia (it requires certain war-specific elements that are filled in by individual deployable wars). The pathing for the common JSP's must be allowed to vary from deployable war to deployable war depending on each war's needs.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, I think I see. Well if you're never actually deploying stub.war, can you not just have 'copy' tasks (assembly plugin) to copy the JSP fragments etc into the WAR you are building? Or have the WAR you are building refer to an extra source section that references the stub/src/main/<code> area.
 
Damon Silver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:Ah, I think I see. Well if you're never actually deploying stub.war, can you not just have 'copy' tasks (assembly plugin) to copy the JSP fragments etc into the WAR you are building? Or have the WAR you are building refer to an extra source section that references the stub/src/main/<code> area.



Yes, and I'm already able to accomplish that, i.e., I can wind up with baz/some.jsp in the deployable war, but I was hoping to avoid the additional baz/foo/bar/some.jsp, since that just leads to war bloat.
 
Damon Silver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should mention also that the deployable wars are not being built as part of a multimodule setup, so it should be possible to package them in isolation (e.g., pull the stub.war out of the repository, use that as a dependency, package depends-on-stub.war).
 
reply
    Bookmark Topic Watch Topic
  • New Topic