Hi,
you have to define the phase. in which the plugin should run.
See [1] for details about the build life cycle, the following code is copied
from there:
Interesting for you is the <phase> entry.
<plugin>
<groupId>com.mycompany.example</groupId>
<artifactId>maven-touch-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>timestamp</goal>
</goals>
</execution>
</executions>
</plugin>
[1]
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
-----Ursprüngliche Nachricht-----
Von: skanatiker [mailto:[email protected]]
Gesendet: Donnerstag, 14. Januar 2010 10:04
An: [email protected]
Betreff: Re: AW: copy resources does not overwrite existing files
I finally found out, that the problem is not the overwriting, but the order
in which the maven tasks are executed. I executed maven with the following
goals:
mvn clean antrun:run package
I guess in that case my resources are copied before compile. In the compile
phase the wrong resource, the one i want to overwrite is copied and
overwrites the file i really want to work with. How can i configure maven,
so it copies my resources between the compile and package phase?
skanatiker wrote:
>
> Yes, it is located in the pluginManagement section:
>
> <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-resources-plugin</artifactId>
> <version>2.4.1</version>
> </plugin>
> ...
>
>
> olamy-2 wrote:
>>
>> Hi,
>> Did you put this plugin configuration in pluginManagement section ?
>>
>>
>>
>> 2010/1/12 skanatiker <[email protected]>:
>>>
>>> Thanks a lot for your quick reply, but unfortunately the file is still
>>> not
>>> being overwritten. Any other ideas?
>>>
>>>
>>> Entner Harald wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>> try to set the ${maven.resources.overwrite} property.
>>>>
>>>> Eg.
>>>>
>>>> <properties>
>>>> <maven.resources.overwrite>true</maven.resources.overwrite>
>>>> </properties>
>>>>
>>>> Even this means that all resources are overwritten.
>>>>
>>>> I haven't tested the solution, so it is not sure that it is working
>>>> that
>>>> way (even i'm pretty sure)
>>>>
>>>> regards, harald
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: skanatiker [mailto:[email protected]]
>>>> Gesendet: Dienstag, 12. Januar 2010 14:33
>>>> An: [email protected]
>>>> Betreff: copy resources does not overwrite existing files
>>>>
>>>>
>>>> Hi,
>>>>
>>>> i want to copy a resource. That works fine, as long as the file does
>>>> not
>>>> exist in the target directory. But in this case the file has to exist
>>>> in
>>>> the
>>>> target directory and has to be overwritten. Here are the two relevant
>>>> parts
>>>> of my pom.xml:
>>>>
>>>> Integration of Resources-Plugin:
>>>>
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-resources-plugin</artifactId>
>>>> <version>2.4.1</version>
>>>> </plugin>
>>>>
>>>>
>>>> Build-Configuration:
>>>>
>>>> <build>
>>>> <resources>
>>>> <resource>
>>>> <directory>conf/${env}</directory>
>>>> <targetPath >../app/pages/global/</targetPath>
>>>> <includes>
>>>> <include>part.jspx</include>
>>>> </includes>
>>>> </resource>
>>>> </resources>
>>>> …
>>>>
>>>> I’ve found out that an overwrite parameter exists, but I have no idea
>>>> where
>>>> to put this parameter
>>>> (http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#overwrite).
>>>>
>>>> I tried:
>>>>
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-resources-plugin</artifactId>
>>>> <version>2.4.1</version>
>>>> <configuration>
>>>> <overwrite>true</overwrite>
>>>> </configuration>
>>>> </plugin>
>>>>
>>>> Or:
>>>>
>>>> <plugin>
>>>> <groupId>org.apache.maven.plugins</groupId>
>>>> <artifactId>maven-resources-plugin</artifactId>
>>>> <version>2.4.1</version>
>>>> <configuration>
>>>> <resources>
>>>> <overwrite>true</overwrite>
>>>> </resources>
>>>> </configuration>
>>>> </plugin>
>>>>
>>>>
>>>> In the first case the build process works fine, but the file is not
>>>> being
>>>> overwritten. In the second case the following error occurs:
>>>>
>>>> ------------------------------------------
>>>> Instead of configuring this parameter directly, try configuring your
>>>> POM
>>>> or
>>>> settings.xml file.
>>>>
>>>> Using the default-value and expression annotations built into the mojo
>>>> itself, these values were found in your build:
>>>>
>>>> Value: null
>>>> Using the expression:null
>>>>
>>>> Value: null
>>>> Using the expression:null
>>>>
>>>> If one of the above expressions rendered a valid value, it may give
>>>> some
>>>> indication of which part of the POM or settings.xml you can modify in
>>>> order
>>>> to change this parameter's value.
>>>> -------------------------------------------
>>>>
>>>> How do I configure the overwritte parameter correctly?
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/copy-resources-does-not-overwrite-existing-files-tp27127591p27127591.html
>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/copy-resources-does-not-overwrite-existing-files-tp27127591p27127925.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>>
>> --
>> Olivier
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/copy-resources-does-not-overwrite-existing-files-tp27127591p27158230.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]