6

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?

Sasha O
  • 3,710
  • 2
  • 35
  • 45

3 Answers3

7

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

Dev
  • 11,919
  • 3
  • 40
  • 53
3

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>
...
maksimov
  • 5,792
  • 1
  • 30
  • 38
  • 2
    Thanks but your answer is about Assembly plugin. Please follow the link in the question, you will see it is about a different plugin. – Sasha O Jan 25 '12 at 01:09
  • 1
    This is correct. Let `appassembler` prepare the assembly into a directory and let `maven-asdsembly-plugin` assemble it with a given descriptor. 1st: https://github.com/michael-simons/neo4j-migrations/blob/3a7bc1b13584d9f12bd5487066c4093f9d161266/neo4j-migrations-cli/pom.xml#L60-L84 2nd: https://github.com/michael-simons/neo4j-migrations/blob/3a7bc1b13584d9f12bd5487066c4093f9d161266/neo4j-migrations-cli/pom.xml#L113-L136 Descriptor: https://github.com/michael-simons/neo4j-migrations/blob/3a7bc1b13584d9f12bd5487066c4093f9d161266/neo4j-migrations-cli/src/main/assembly/assembly-java.xml – Michael Simons Nov 02 '21 at 07:52
0

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>
KIC
  • 5,887
  • 7
  • 58
  • 98