I'm considering moving my solution to using the concept of WAR overlays;
a WAR project that requires certain javascripts specifies those as project
dependencies, which themselves are simple WAR projects with only js files in
their correct paths

they get slapped onto the using WARs, and presto, no weirdness with copying
and unzipping directly

On Tue, Jun 15, 2010 at 6:23 PM, Haszlakiewicz, Eric <ehas...@transunion.com
> wrote:

> >-----Original Message-----
> >From: Shan Syed [mailto:shan...@gmail.com]
> >
> >I've worked on projects that share common javascript files, so I used a
> >simple assembly descriptor to zip each set of files and install them as
> >maven artifacts
> >WAR projects then just specified them as dependencies in their POMs
> >it's nice then to be able to treat these artifacts like any other
> project
> >(versioned, deployable to a repo, etc)
> >I used the maven-dependency plugin to unzip them to a standard folder
> >
> >we didn't require any parsing or compiling of the js, so this worked
> out
> >fine for simple packaging and unzipping
>
> I ended up doing something similar.  In case anyone else needs to do
> this in the future the steps I took were:
>  1) Create a jar file containing prototype-1.6.1.js at the top level
> [*1].  I also included a hand written README file in the META-INF
> directory with information about where the js file came from.
>  2) I deployed this to my local nexus repository as
> org.prototypejs:prototype:jar:1.6.1
>  3) I added the dependency to my webapp's pom.xml file with the
> "provided" scope.  That scope is needed to prevent the jar file from
> being included in the war.  (for some reason using "compile" scope
> didn't omit it)
>  4) I added the overlay configuration to the maven-war-plugin as
> described in my original message.  Since the README file is in the
> META-INF directory it doesn't get included.
>
> And now I get the js file extracted from the dependency jar file and
> included in the right place in the war file.
>
> This probably wouldn't work if prototypejs actually provided their own
> artifact, since the js file would probably be in a subdirectory, and
> there's no way to tell maven to rearrange things.
> However, in that case, I think I'd be able to use the maven-dependency
> plugin to unpack it to a temporary location, and then use some inline
> tasks in a maven-antrun-plugin to move the files to the right place.
> I've done this in other projects I've worked on and it's kind of
> annoying that maven doesn't support stuff like this natively, but at
> least it works.
>
> eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to