diff --git a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java index 580d7908..24526df0 100644 --- a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java +++ b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java @@ -210,7 +210,7 @@ public abstract class AbstractExecWarMojo * * @since 2.2 */ - @Parameter( property = "maven.tomcat.exec.war.httpPort" ) + @Parameter(property = "maven.tomcat.exec.war.httpPort") protected String httpPort; public void execute() @@ -477,7 +477,7 @@ else if ( warRunDependencies != null && !warRunDependencies.isEmpty() ) protected void copyDirectoryContentIntoArchive( File pSourceFolder, String pDestinationPath, ArchiveOutputStream pArchiveOutputSteam ) - throws FileNotFoundException, IOException + throws IOException { // Scan the directory @@ -492,12 +492,19 @@ protected void copyDirectoryContentIntoArchive( File pSourceFolder, String pDest getLog().debug( "include configuration file : " + pDestinationPath + aIncludeFileName ); File aInputFile = new File( pSourceFolder, aIncludeFileName ); - FileInputStream aSourceFileInputStream = new FileInputStream( aInputFile ); - - pArchiveOutputSteam.putArchiveEntry( new JarArchiveEntry( pDestinationPath + aIncludeFileName ) ); - IOUtils.copy( aSourceFileInputStream, pArchiveOutputSteam ); - pArchiveOutputSteam.closeArchiveEntry(); + FileInputStream aSourceFileInputStream = null; + try + { + aSourceFileInputStream = new FileInputStream( aInputFile ); + pArchiveOutputSteam.putArchiveEntry( new JarArchiveEntry( pDestinationPath + aIncludeFileName ) ); + IOUtils.copy( aSourceFileInputStream, pArchiveOutputSteam ); + pArchiveOutputSteam.closeArchiveEntry(); + } + finally + { + IOUtils.closeQuietly( aSourceFileInputStream ); + } } }