maven-Tomcat-plugin Overlay Task execution fails in windows with
java.io.IOException[The filename, directory name, or volume label syntax is
incorrect], when targetPath is present
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: MTOMCAT-131
URL: https://issues.apache.org/jira/browse/MTOMCAT-131
Project: Apache Tomcat Maven Plugin
Issue Type: Bug
Environment: Fails in Windows, it works fine in Mac & Linux/Unix
Reporter: Tony Kollamparambil
Priority: Minor
Thanks for introducing the "Overlay concept", which is very helpful. we have a
scenario in which we need to overlay a war file over the other. we have
successfully implemented the overlay in our project.
maven install is failing with java.io exception when we build the module in
WINDOWS with some path in the overlays:overlay:targetpath tag(its works fine in
the mac/linux/unix/solaris).
Trace :
ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war
(default-war) on project enrollment-rest: Failed to copy file for overlay [ id
xxxxxxx:yyyyyyyy]: The filename, directory name, or volume label syntax is
incorrect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project
xxx-xxxx: Failed to copy file for overlay [ id xxxxxxx:yyyyyyyy].
Root Cause:
As per the analysis that we had performed, its a code bug. Please refer line#
84-88 present in the
http://code.google.com/p/maven-alfresco-archetypes/source/browse/trunk/plugins/maven-amp-plugin/src/main/java/org/alfresco/maven/plugin/amp/packaging/OverlayPackagingTask.java?r=127.
ie;
String targetPath = overlay.getTargetPath();
if (!targetPath.endsWith( "/" ))
{
targetPath = targetPath + "/";
}
by considering the above code snippet as a source of truth, windows will not
recognize the forward slash ("/") as a valid file separator. file separator
would vary from OS to OS(it works fine in linux and mac, since the file
separator for these operating systems are "/").
System.getProperties("file.separator") can be used for computing the
file.separator. Please do the needful. Thanks in advance
Stack Trace :
[DEBUG] OverlayPackagingTask performPackaging overlay.getTargetPath()
C:\projects\xxxxxxx\yyyyyy\target
[INFO] Processing overlay [ id xxxxxxx:yyyyyyyy]
[DEBUG] Overlay [ id xxxxxxx:yyyyyyyy] was already unpacked
ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war
(default-war) on project enrollment-rest: Failed to copy file for overlay [ id
xxxxxxx:yyyyyyyy]: The filename, directory name, or volume label syntax is
incorrect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project
xxx-xxxx: Failed to copy file for overlay [ id xxxxxxx:yyyyyyyy].
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to copy file
for overlay [ id xxxxxxxxx:yyyyyyyyy]
at
org.apache.maven.plugin.war.packaging.OverlayPackagingTask.performPackaging(OverlayPackagingTask.java:97)
at
org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)
at
org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)
at
org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:215)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:177)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.io.IOException: The filename, directory name, or volume label
syntax is incorrect
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
at java.io.File.getCanonicalPath(File.java:559)
at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1042)
at
org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:293)
at
org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask$1.registered(AbstractWarPackagingTask.java:150)
at
org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:211)
at
org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:145)
at
org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFiles(AbstractWarPackagingTask.java:103)
at
org.apache.maven.plugin.war.packaging.OverlayPackagingTask.performPackaging(OverlayPackagingTask.java:92)
... 25 more
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]