[appassembler] collaborating with maven-assembly-plugin
-------------------------------------------------------

                 Key: MOJO-539
                 URL: http://jira.codehaus.org/browse/MOJO-539
             Project: Mojo
          Issue Type: Improvement
            Reporter: Mathieu Champlon


I find the appassembler-maven-plugin really valuable, especially since I was 
just about to start manually writing my own bat/sh scripts...

However I wonder if this plugin does not partly overlap with the 
maven-assembly-plugin [1] or the dependency-maven-plugin [2].
Maybe appassembler should be only about generating scripts and be able to 
collaborate with the other plugins for the remaining part ?

My requirement was to have appassembler manage the following layout :
. bin/ scripts
. lib/ all jars
Thus a good old flat distribution (like maven itself for example).

The maven-assembly-plugin is already able to handle the 'lib/' part and I was 
looking for a solution to have appassembler collaborate with it.
I realized this was not exactly possible because of the way appassembler 
outputs artifacts to a repository.
So I patched it :
 . the first step was to add a 'repositoryName' configuration variable in order 
to be able to customize the hard-coded "repo" (so I can set it to "lib" 
instead).
 . the next step was to add a 'flat' repositoryLayout that would install all 
the artifacts in the "repo" root directory.
 . the last step was to add a 'installArtifacts' boolean configuration flag to 
be able not to generate the "repo" (this feature is actually not really 
mandatory).

Therefore I was able to achieve my goal by combining appassembler with the 
assembly plugin : appassembler only creates "bin" scripts which are then 
included in the assembly process.

Here is what my pom looks like :
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <configuration>
          <repositoryLayout>flat</repositoryLayout>
          <repositoryName>lib</repositoryName>
          <installArtifacts>false</installArtifacts>
          <programs>
            <program>
              <mainClass>com.mycompany.app.App</mainClass>
              <name>app</name>
            </program>
          </programs>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>assembly.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>assembly</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

And the assembly.xml configuration file :

<assembly>
  <id>bin</id>
  <formats>
    <format>tar.gz</format>
    <format>tar.bz2</format>
    <format>zip</format>
  </formats>
  <fileSets>
    <fileSet>
      <directory>target/appassembler/bin</directory>
      <outputDirectory>bin</outputDirectory>
    </fileSet>
  </fileSets>
  <dependencySets>
    <dependencySet>
      <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
</assembly>


[1] http://maven.apache.org/plugins/maven-assembly-plugin/introduction.html
[2] http://mojo.codehaus.org/dependency-maven-plugin/introduction.html


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to