Issue Details (XML | Word | Printable)

Key: MAPPASM-40
Type: New Feature New Feature
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Trygve Laugstol
Reporter: David Hoffer
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Mojo AppAssembler Plugin

Provide options to zip & copy assembled application

Created: 09/Jul/07 12:11 PM   Updated: 12/May/08 02:09 AM   Resolved: 10/Jul/07 07:03 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide

The appassembler works great for assembling an application that can be launched with a batch/shell script but I can't distribute this as it is. What I need is for the results to be included in a zip file named with the proper name/version.

I also need a mechanism to copy this zip file to a common location where applications are stored. This later step could be performed by this plugin or another which ever is the best approach. The end result of this is to be able to automate the release of an application using the appassembler plugin.

In summary, what I want to be able to do to release my application is:

mvn release:prepare release:perform package appassembler:assemble (or equiv.)

where this results in the application being zipped and placed in specified network folder.



Trygve Laugstol added a comment - 10/Jul/07 07:03 AM

You really shouldn't use the appassembler that way. For one there is no uniform way to build the project and it won't work in a multi-project build.

The assembly plugin already has all the functionality you need to package and deliver zips and tarballs. I suggest you use that instead and put the tarball generation plugins in a "assembly" phase that is run on releases.


David Hoffer added a comment - 10/Jul/07 07:29 AM

Perhaps you can help me understand your comments. I have used the assembly plugin the past and have had some difficulty with its configuration. It does not seem to have all the functionality needed.

Most significant is the batch/shell script generation, my understanding is that it does not do this. However the appassembler plugin does this nicely. The assembly plugin can make an executable jar however often times we want batch/shell script generation. How can I do this?

Also it is fine to use either of these plugins but unless I can copy(deploy) the resulting file(s) I cannot automate the build process, the files just remain in some obscure build target location. How can I copy the resulting file(s) to a release server? Is there a plugin to do this?


Trygve Laugstol added a comment - 10/Jul/07 07:57 AM

Sorry, I should have been a bit more explicit.

Run the appassembler plugin first and include the target directory. Example config:

<assembly>
  <id>bin</id>
  <formats>
    <format>tar.gz</format>
  </formats>
  <fileSets>
    <fileSet>
      <directory>src/main/etc</directory>
      <outputDirectory>etc</outputDirectory>
      <lineEnding>unix</lineEnding>
    </fileSet>
    <fileSet>
      <directory>target/appassembler/bin</directory>
      <outputDirectory>bin</outputDirectory>
      <lineEnding>unix</lineEnding>
      <fileMode>0755</fileMode>
    </fileSet>
    <fileSet>
      <directory>target/appassembler/repo</directory>
      <outputDirectory>repo</outputDirectory>
    </fileSet>
  </fileSets>
</assembly>

In my project I'm runing both the "directory-inline" and "attached" goals of the assembly plugin to make it both package the plugin and to have a complete binary under target/..

To include the tarball into the repository, use the build-helper plugin to attach a file to your build: http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html

The appassembler plugin is lacking documentation, I know. This should all be on the site descibed and in an example project somewhere.


David Hoffer added a comment - 11/Jul/07 01:08 PM

Can you show how in your pom you runing both the "directory-inline" and "attached" goals of the assembly plugin?

Also how do you run the appassembler plugin first? I need both the appassembler and then the assembly plugins to be run after every release goal, where the release goal is run by our automated build server. Therefore I want release:prepare release:perform to fire all this off.

Also I see the build-helper plugin can be used to add files for repo deployment. However since this is the final application package I don't see any value in putting this in a maven repo. Rather I want to but this in a network file share which is easy for users to get to and download from. Is there a plugin to help with this? Now as I am thinking about this...if it is possible to place this final application package on the site generated by maven then this would be good also. Basically I am looking for a way to publish this final application package in a location easily assessable by humans rather than by maven.


Trygve Laugstol added a comment - 12/Jul/07 05:22 AM

Bind the appassembler to generate-resources and bind the assembler to something before package. Put those two plugins in a profile and make the release plugin include that profile when releasing. Make sure that the release plugin runs with the profile enabled, using something like the arugments configuration on the perform mojo (though I was sure there was a special configuration element to select which profiles to use).

As for putting stuff on a network drive, I'd still point people to the Maven repository. But if you really have to use some antrun magic to copy stuff around.

http://maven.apache.org/plugins/maven-release-plugin/perform-mojo.html#arguments

This example is a bit dated now, haven't touched the code in a while:

<plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <programs>
            <program>
              <name>dpserver</name>
              <mainClass>no.java.dp.server.cli.DpServerCli</mainClass>
            </program>
            <program>
              <name>installer</name>
              <mainClass>no.java.dp.server.installer.InstallerCli</mainClass>
            </program>
          </programs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <!--<phase>package</phase>-->
            <goals>
              <goal>directory-inline</goal>
              <goal>attached</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/standalone.xml</descriptor>
          </descriptors>
          <tarLongFileMode>gnu</tarLongFileMode>
        </configuration>
      </plugin>
    </plugins>