You only have a configuration problem :)

It should be:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<outputDirectory>target/resources</outputDirectory>
</configuration>
</plugin>

Since this goal is already bound to the "process-resources" phase, you need not set it in the executions tag if you're executing 'mvn process-resources' or 'mvn clean package' (which occurs after the process-resources phase in the build lifecycle).

- Deng


Ondr(ej C(ernoš wrote:
Hi all,

I am quite new to maven, so I apologize in advance if my problem is
caused by my ignorance. Actually I hope it is.

I have a small project, for evaluation and management persuade
purposes, jar packaging, consisting of some java classes and some
resources. Nothing big. I don't want the resources to be bundled in
the resulting jar, however, I would like them to be copied into the
target/ directory during the build. So I decided to configure the
maven-resources-plugin so as to use different output directory than
the default:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<outputDirectory>target/resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

As i get it, during the "resources" goal on the plugin which is bound
to the process-resources phase, the outputDirectory should be
configured to target/resources.

When i run the build this way:

$ mvn -X resources:resources

I found these lines in the log:

--- sniff ---
[INFO] ----------------------------------------------------------------------------
[INFO] Building projectX
[INFO] task-segment: [resources:resources]
[INFO] ----------------------------------------------------------------------------
--- sniff ---
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG] (f) filters = []
[DEBUG] (f) outputDirectory =
/home/user/projects/devel/projectX/target/classes
[DEBUG] (f) project = [EMAIL PROTECTED]
[DEBUG] (f) resources = [EMAIL PROTECTED]

and the resources end up in the target/classes directory, which is
something I do not want. However, when I run it with the phase name:

$ mvn -X process-resources
--- sniff ---
[INFO] ----------------------------------------------------------------------------
[INFO] Building projectX
[INFO] task-segment: [process-resources]
[INFO] ----------------------------------------------------------------------------
--- sniff ---
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG] (f) filters = []
[DEBUG] (f) outputDirectory =
/home/user/projects/devel/projectX/target/classes
[DEBUG] (f) project = [EMAIL PROTECTED]
[DEBUG] (f) resources = [EMAIL PROTECTED]
[DEBUG] -- end configuration --
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->
[DEBUG] (f) filters = []
[DEBUG] (f) outputDirectory = target/resources
[DEBUG] (f) project = [EMAIL PROTECTED]
[DEBUG] (f) resources = [EMAIL PROTECTED]
[DEBUG] -- end configuration --

which, in the end, results in the fact the resources are copied twice,
once in the default target/classes and once in the configured
target/resources directories.

When I run mvn clean package, I end up in the same situation.

Used versions:
Maven version: 2.0.6
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Linux hostname 2.6.18.8-0.3-bigsmp

Googling suggested there were some issues with copying resources in
the past (and inexistent target directories during the
process-resources phase), but it seemed to me the resulting bugfixes
were sent upstream and these issues were solved.

Thanks in advance for any kind of help.

Ondrej Cernos

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:602,46433296209091885597236!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to