In order to stop Maven from putting your resources into your jar you
need to override the default targetpath directory for the resources.
This is done in the POM in the <resources> section. If you take a look
at what I have below...this is telling maven to output any files found
in the src/main/resources to target/resources. This way...the maven pkg
cmd won't add them to your jar. As you can see I also have maven setup
to exclude certain sub folders in there because I customize maven to
only filter files found in the filtered folder and only put files found
in the packaged folder into the jar. I then use assemblies as Wendy
described to create the structure similar to what you listed below. If
you want more details on how I set all this up you can email me
directly.
Ie. <resources>
<resource>
<targetPath>../resources</targetPath>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>filtered/**</exclude>
<exclude>packaged/**</exclude>
<exclude>dir.info</exclude>
</excludes>
</resource>
<resource>
-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Friday, December 01, 2006 8:46 AM
To: Maven Users List
Subject: Re: Putting resources to somewhere else
On 12/1/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]>
> I would like maven to put my resources not into the jar file, but next
> to classes in a resources directory, so my structure would be:
>
> Component +
> - lib +
> - mycomponent.jar
> - resources +
> - myresource.xml
>
> Etc.
>
> Could anybody help how to tell the resource processor plugin where to
> put it? I could tell only relative path within target/classes, but not
> relative to output directory.
If you want to build something that contains jars and other files,
look at the assembly plugin:
http://maven.apache.org/plugins/maven-assembly-plugin/
(The current version is actually 2.1, not 2.2 as it says.)
Otherwise, whatever you put in src/main/resources will be mirrored in
the jar. So if you want something at the "top level" of the jar, put
it directly in src/main/resources. Then create the desired directory
structure from there. It will overlay (or sit beside) the classes
compiled from code in src/main/java. You can use <resources> in the
pom to identify things to copy into the jar.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]