views:

344

answers:

2

I've a base project which has a dependency on a custom war to be downloaded from a remote repository.
I'm able to download and run the war, however the custom war has some html & js files which i need to get extracted in my base project's webapp directory.
How do I specify a location for the custom.war to explode at a specified directory?

A: 

the custom war has some html & js files which i need to get extracted in my base project's webapp directory.

I'm not sure to understand what location this is.

How do I specify a location for the custom.war to explode at a specified directory?

If you are using overlays, then you can use the targetPath in the overlay element:

  • targetPath - sets the target relative path in the webapp structure, which is only available for war types. By default, the content of the overlay is added in the root structure of the webapp.

But as I said, I'm not sure to understand where you want to extract the mentioned files so I don't know if this will suit your needs. If it doesn't, I think you'll have to use the antrun plugin (in a second step).

Update: According to the comments of JETTY-1027, you should be able to use mvn jetty:run with a webapp project that uses overlays with jetty 6.1.19 (this comment of JETTY-1095 mentions jetty 6.1.20).

If this doesn't work, a workaround is to use mvn jetty:run-war. Another option would be to use the fix of JETTY-1027 (available in the trunk of the jetty-maven-plugin and to be released in version 7.0.2).

Pascal Thivent
To be clear on what I meant - I have maven project - myproject which contains the war dependency mycustom.war. mycustom.war contains mycustom.html file. I want to have the mycustom.html to be extracted to myproject/src/main/webapp directory when I run mvn jetty:run on myproject. How do I do that?
soumik
To add, I'm using maven-overlay-plugin and i've not set the targetPath to any specific value.
soumik
@soumik You can do this with overlays. But src/main/webapp should be the default path. So, what's the problem exactly? Does it occur only when running `jetty:run`? Is the war "correct" when you run `mvn package`
Pascal Thivent
Pascal,Yes the war file is correct. Actually if a just do a mvn jetty:deploy-war on the war file with appropriate settings under the jetty plugin, its able to extract all the html files in mycustom.war to webapp directory.But when i run mvn jetty:run I see that it runs the jar/classes withing the war, but the html files are not placed in the webapp directory. Am I missing something?
soumik
Is there any other way that I can verify the correctness of a war in my repository?
soumik
A: 

Thanks Pascal,
JETTY-1027 does indeed take resolve my query. However, I'm stuck with Jetty 6.1.26 for now. I wish they did a backport to release 6 too inaddition to fixing it on Jetty 7.

soumik
You're welcome. I'm afraid you'll have to use mvn jetty:run-war as workaround then.
Pascal Thivent