Closed jrodan closed 9 years ago
I believe that this happens because you want to replace the absolute path and not only within the working directory.
There is a parameter on the resource
called workOnFullPath
which you can set to true
. Could you try this?
<resource>
<directory>${project.build.directory}</directory>
<move>true</move>
<workOnFullPath>true</workOnFullPath>
....
</resource>
When I change it:
[ERROR] Failed to execute goal ch.mfrey.maven.plugin:copy-maven-plugin:0.0.1:copy (default-cli) on project skp-foundation: Execution default-cli of goal ch.mfrey.maven.plugin:copy-maven-plugin:0.0.1:copy failed. NullPointerException -> [Help 1]
[INFO] --- copy-maven-plugin:0.0.1:copy (copy) @ skp-foundation --- [INFO] Resource: WorkingDir: D:\dev\LR\skp\workspace\skp-foundation\target Paths: D:\dev\LR\skp\workspace\skp-foundation\target -> D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext Replaces:
[INFO]
Looks like its time for some unit tests ;)
I have added some unit tests. I see you are running on Windows. I also added some normalization by default.
Could you try to build the snapshot and try your deployment using 0.0.2-snapshot? If that runs I push a new version 0.0.2.
Tested it on a windows machine and this should work now in v 0.0.2
Tried it again:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building skp-foundation 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) @ skp-foundation ---
[INFO]
[INFO] --- copy-maven-plugin:0.0.2:copy (copy) @ skp-foundation ---
[INFO] ----------
Resource: undefined
WorkingDir: D:\dev\LR\skp\workspace\skp-foundation\target
Charset: UTF-8
Move: true
WorkOnFullPath: true
NormalizePath: true
Includes:
*.jar
Excludes:
Paths:
D:\dev\LR\skp\workspace\skp-foundation\target -> D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext
Replaces:
[INFO] ---
[INFO] D:/dev/LR/skp/workspace/skp-foundation/target/skp-foundation.jar
[INFO] D:/dev/LR/skp/liferay-portal-6.2-ee-sp10/deploy/tomcat-7.0.42/lib/ext/skp-foundation.jar
[INFO] mv D:\dev\LR\skp\workspace\skp-foundation\target\skp-foundation.jar
-> D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext\skp-foundation.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.571 s
[INFO] Finished at: 2015-03-30T09:46:05+02:00
[INFO] Final Memory: 8M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ch.mfrey.maven.plugin:copy-maven-plugin:0.0.2:copy (copy) on project skp-foundation: Could not rename file: Destination 'D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext\skp-foundation.jar' already exists -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Settings:
<plugin>
<groupId>ch.mfrey.maven.plugin</groupId>
<artifactId>copy-maven-plugin</artifactId>
<version>0.0.2</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<showfiles>true</showfiles>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<move>true</move>
<workOnFullPath>true</workOnFullPath>
<includes>
<include>*.jar</include>
</includes>
<paths>
<path>
<from>${project.build.directory}</from>
<to>${liferay.app.server.lib.global.dir}</to>
</path>
</paths>
<!-- <replaces>
<replace>
<from>${project.build.directory}</from>
<to>${liferay.app.server.lib.global.dir}</to>
</replace>
</replaces> -->
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
When changing to replace algorithm with the same path variables:
[INFO] --- copy-maven-plugin:0.0.2:copy (copy) @ skp-foundation ---
[INFO] ----------
Resource: undefined
WorkingDir: D:\dev\LR\skp\workspace\skp-foundation\target
Charset: UTF-8
Move: true
WorkOnFullPath: true
NormalizePath: true
Includes:
*.jar
Excludes:
Paths:
Replaces:
D:\dev\LR\skp\workspace\skp-foundation\target -> D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext
[INFO] mv D:\dev\LR\skp\workspace\skp-foundation\target\skp-foundation.jar
-> D:\dev\LR\skp\workspace\skp-foundation\target\skp-foundation.jar
[INFO]
[INFO] --- copy-maven-plugin:0.0.2:copy (default-cli) @ skp-foundation ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.553 s
[INFO] Finished at: 2015-03-30T09:47:52+02:00
[INFO] Final Memory: 10M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ch.mfrey.maven.plugin:copy-maven-plugin:0.0.2:copy (default-cli) on project skp-foundation: Execution default-cli of goal ch.mfrey.maven.plugin:copy-maven-plugin:0.0.2:copy failed. NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
The issue is that the file cannot be written as the file exists already:
Could not rename file: Destination 'D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext\skp-foundation.jar' already exists
The Replaces
algorithm is to replace content inside the files
, not the files themself :)
That's what I also got. The question is, how can I overwrite existing files? Maybe another flag would be helpful?
Just opened another issue for that. It's not possible at the moment.
I get the following log:
" [INFO] --- copy-maven-plugin:0.0.1:copy (copy) @ skp-foundation --- [INFO] Resource: WorkingDir: D:\dev\LR\skp\workspace\skp-foundation\target Paths: D:\dev\LR\skp\workspace\skp-foundation\target -> D:\dev\LR\skp\liferay-portal-6.2-ee-sp10\deploy\tomcat-7.0.42\lib\ext Replaces:
[INFO]
The Paths output is correct but the last output lines starting with - and + is incorrect. The destination folder is not correctly set.
Here is also my configuration: