appassembler maven plugin doesn't set "execute" permissions on generated script

2.1k views Asked by At

The AppAssembler Maven plugin does a great job of generating distribution for me. One last problem is that the generated Shell script does not have execution permissions so I need to set them manually.

I am on Linux RedHat

Does anybody know of a clean way to set them automatically?

3

There are 3 answers

0
Dev On BEST ANSWER

The only way to do this is to process the file with another maven plugin like Antrun or Assembly after running AppAssembler.

This issue (see link below) has been brought up on the AppAssembler project issue tracker and it was rejected as Won't Fix.

Issue: MAPPASM-54

2
maksimov On

I think it can be set in your assembly.xml, in the fileSet tag:

<fileSets>
<fileSet>
  <directory>src/resources/bin</directory>
  <lineEnding>keep</lineEnding>
  <useDefaultExcludes>true</useDefaultExcludes>
  <outputDirectory>bin</outputDirectory>
  <includes>
    <include>*.bat</include>
    <include>*.sh</include>
  </includes>
  <fileMode>744</fileMode>
</fileSet>
...
0
KIC On

Since Maven 3.0.3 all plugins are executed in the order they are in your pom.xml. So setting the executeable flag in a platform independet manner is as easy as using the maven-enforcer-plugin right after your appassembler plugin.

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.3.1</version>
        <executions>
          <execution>
            <id>enforce-beanshell</id>
            <phase>package</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <evaluateBeanshell>
                  <condition>
                      import java.io.File;

                      print("set executable for file ${basedir}/dist/bin/mql");
                      new File("${basedir}/dist/bin/mql").setExecutable(true,false);                   

                      true;
                  </condition>
                </evaluateBeanshell>
              </rules>
              <fail>false</fail>
            </configuration>
          </execution>
        </executions>  
      </plugin>