We're updating the issue view to help you get more done. 

Adding a configuration file to a non-existing target directory result in FileNotFoundException

Description

When try to add an new file via maven configfiles that not exists in the target location / the default server configuration (installs directory), then an exception (CargoException / java.io.FileNotFoundException) is thrown (because the one tryes to load the file from the target location). But if if the file already exists in the target location, then every thing works fine.

Exception (mvn install -X

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:start (start-container) on project cfmt: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:start failed: Failed to copy source file [c:\eclipseWS_RalphCFMA\cfmt/src/test/serverresources/context.xml] to [c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x/conf/Catalina/localhost/context.xml] with FilterChain: c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x\conf\Ca talina\localhost\context.xml (Das System kann den angegebenen Pfad nicht finden) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:start (start-container) on project cfmt: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:start failed: Failed to copy source file [c:\eclipseWS_RalphCFMA\cfmt/src/test/serverresources/context.xml] to [c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x/conf/Catalina/localhost/context.xml] with FilterChain at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225) 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:534) 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.PluginExecutionException: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.1.1:start failed: Failed to copy source file [c:\eclipseWS_RalphCFMA\cfmt/src/test/serverresources/context.xml] to [c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x/conf/Catalina/localhost/context.xml] with FilterChain at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:116) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: org.codehaus.cargo.util.CargoException: Failed to copy source file [c:\eclipseWS_RalphCFMA\cfmt/src/test/serverresources/context.xml] to [c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x/conf/Catalina/localhost/context.xml] with FilterChain at org.codehaus.cargo.util.DefaultFileHandler.copyFile(DefaultFileHandler.java:186) at org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration.configureFiles(AbstractStandaloneLocalConfiguration.java:251) at org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration.configure(AbstractStandaloneLocalConfiguration.java:79) at org.codehaus.cargo.container.spi.configuration.builder.AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder.configure(AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder.java:123) at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(AbstractLocalContainer.java:159) at org.codehaus.cargo.maven2.AbstractContainerStartMojo.doExecute(AbstractContainerStartMojo.java:55) at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:52) at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:278) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) ... 20 more Caused by: java.io.FileNotFoundException: c:\eclipseWS_RalphCFMA\cfmt\target\cargo\configurations\tomcat6x\conf\Catalina\localhost\context.xml (Das System kann den angegebenen Pfad nicht finden) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:179) at java.io.FileOutputStream.<init>(FileOutputStream.java:70) at java.io.FileWriter.<init>(FileWriter.java:46) at org.codehaus.cargo.util.DefaultFileHandler.newWriter(DefaultFileHandler.java:668) at org.codehaus.cargo.util.DefaultFileHandler.copyFile(DefaultFileHandler.java:156) ... 28 more [ERROR] [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 relevant part of maven pom:

pom.xml

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.1.1</version> <!-- <version>1.1.1</version> --> <executions> <execution> <id>start-container</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <configuration> <wait>false</wait> <!-- Container configuration --> <container> <type>installed</type> <containerId>tomcat6x</containerId> <zipUrlInstaller> <url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip</url> </zipUrlInstaller> <output>${project.build.directory}/tomcat/container.log</output> <append>false</append> <log>${project.build.directory}/tomcat/cargo.log</log> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>com.springsource.javax.mail</artifactId> </dependency> </dependencies> </container> <configuration> <configfiles> <configfile> <file>${basedir}/src/test/serverresources/context.xml</file> <todir>conf/Catalina/localhost</todir> </configfile> </configfiles> </configuration> </configuration> </plugin>

Status

Assignee

Savas Ali Tokmen

Reporter

Ralph Engelmann

Fix versions

Affects versions

1.1.1

Priority

Minor