diff --git a/appassembler-maven-plugin/src/it/programNameDuplicateTest/verify.groovy b/appassembler-maven-plugin/src/it/programNameDuplicateTest/verify.groovy index 37e888ee..b10fdb27 100644 --- a/appassembler-maven-plugin/src/it/programNameDuplicateTest/verify.groovy +++ b/appassembler-maven-plugin/src/it/programNameDuplicateTest/verify.groovy @@ -53,11 +53,13 @@ println "ProjectVersion:" + projectVersion def buildLogFile = new File( basedir, "build.log"); -if (mavenVersion.equals("3.0.4") || mavenVersion.equals("3.0.5") || mavenVersion.equals( "3.1.0" ) || mavenVersion.equals( "3.1.1" ) || mavenVersion.equals( "3.2.1" ) || mavenVersion.equals( "3.2.2" )) { +//All Maven 3.X versions +if (mavenVersion.startsWith("3.")) { t.checkExistenceAndContentOfAFile(buildLogFile, [ '[ERROR] Failed to execute goal org.codehaus.mojo:appassembler-maven-plugin:' + projectVersion + ':assemble (default) on project programNameDuplicate-test: The program id: program-01-test exists more than once! -> [Help 1]', ]); } else { + //Maven 2.X output looks different... t.checkExistenceAndContentOfAFile(buildLogFile, [ 'org.apache.maven.BuildFailureException: The program id: program-01-test exists more than once!', ]); diff --git a/appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/script/DefaultScriptGenerator.java b/appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/script/DefaultScriptGenerator.java index fb618bd1..7f4a6e12 100644 --- a/appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/script/DefaultScriptGenerator.java +++ b/appassembler-maven-plugin/src/main/java/org/codehaus/mojo/appassembler/daemon/script/DefaultScriptGenerator.java @@ -165,7 +165,6 @@ public void createBinScript( String platformName, Daemon daemon, File outputDire FileWriter out = null; File binFile; - try { in = getScriptTemplate( platformName, daemon ); @@ -239,21 +238,24 @@ public void createBinScript( String platformName, Daemon daemon, File outputDire binFile = new File( binDir, programName + platform.getBinFileExtension() ); if ( Platform.UNIX_NAME.equals( platformName ) ) { - try - { - // in case it already exists, make it writable. Maybe deleting would be better? - ArchiveEntryUtils.chmod( binFile, 0777, getLogger(), true ); - } - catch ( ArchiverException ae ) + // Only in case of an existing file it does make sense + if ( binFile.exists() ) { - // give up + try + { + // in case it already exists, make it writable. Maybe deleting would be better? + ArchiveEntryUtils.chmod( binFile, 0777, getLogger(), true ); + } + catch ( ArchiverException ae ) + { + throw new DaemonGeneratorException( "Failed to change permission for bin file.", ae ); + } } } - out = new FileWriter( binFile ); - getLogger().debug( - "Writing shell file for platform '" + platform.getName() + "' to '" + binFile.getAbsolutePath() + "'." ); + getLogger().debug( "Writing shell file for platform '" + platform.getName() + "' to '" + + binFile.getAbsolutePath() + "'." ); IOUtil.copy( interpolationFilterReader, out ); } @@ -275,11 +277,12 @@ public void createBinScript( String platformName, Daemon daemon, File outputDire { try { - ArchiveEntryUtils.chmod( binFile, 0555, getLogger(), true ); + // TODO: The permissions should be made configurable. + ArchiveEntryUtils.chmod( binFile, 0755, getLogger(), true ); } catch ( ArchiverException ae ) { - // give up. + throw new DaemonGeneratorException( "Failed to change permission for bin file.", ae ); } } }