Ludwig,

I think I misunderstood what you were asking in the original email. Let me try again...

If I understand correctly, you want to keep the 'external' resource directory name in the root of the war instead of copying it's contents to the root of the war. This can be accomplished by adding a <targetPath> element to the resource definition. My example below assumes you are renaming the resource2 directory to myTarget in the war.

In your case, with a webResource definition like:

<configuration>
  <webResources>
    <resource>
      <directory>resource2</directory>
      <targetPath>myTarget</targetPath>
    </resource>
  </webResources>
</configuration>

Applied to a project layout like:

pom.xml
resource2/external-resource.jpg
resource2/image2/external-resource2.jpg
src/main/webapp/WEB-INF/web.xml
...

Would produce a war layout like:

myTarget/external-resource.jpg
myTarget/image2/external-resource2.jpg
WEB-INF/web.xml

Hopefully this is the answer you're looking for.

Joe Hindsley


Ludwig Magnusson wrote:
But the problem is that I configure my webapp with property files. Some
properties point to other files. Won't those links be wrong in any case
since the files will be in a new directory?
I suppose I could use separate configurations for development and live but
it seems like a lot of work.
I don't really understand why the structure needs to be different.
/Ludwig

-----Original Message-----
From: Joe Hindsley [mailto:jhinds...@gmail.com] Sent: den 20 november 2009 17:02
To: Maven Users List
Subject: Re: [WAR-plugin] Can I put my resources in their original folder?

Hi Ludwig,

I would recommend putting those directories and files in the src/main/webapp directory. The maven war plugin puts everything under src/main/webapp into the base of the war.

In your case:

src/main/webapp/external-resource.jpg
src/main/webapp/image2/external-resource2.jpg

would give you the war layout:

./external-resource.jpg
./image2/external-resource2.jpg

Hope this helps,

Joe Hindsley


Ludwig Magnusson wrote:
The first example on this page

<http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-
webresources.html>

http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-w
ebresources.html says that resources outside the src folder will be placed
in the root of the war

Ex, with this filestructure:

|-- pom.xml

|-- resource2

|   |-- external-resource.jpg

|   `-- image2

|       `-- external-resource2.jpg

//more structure

And this configuration of the war-plugin

<configuration>
  <webResources>
    <resource>
      <!-- this is relative to the pom.xml directory -->
      <directory>resource2</directory>
    </resource>
  </webResources>
</configuration>

The war file will be structured like this:

//more structure

|-- external-resource.jpg
|-- image2
|   `-- external-resource2.jpg

Is it possible to structure the war-file like the original filestructure?

I.e having all the extra resources in the resource2-folder, and that
folder
in the root of the war-file?

/Ludwig



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to