Question

I have a java application.

I can run the Maven Release task which will do some nice things for me:

  • Change Version number from 1.0.0-SNAPSHOT to 1.0.0
  • Increment the version number in my pom to 1.0.1-SNAPSHOT
  • Tag the release in source control
  • Upload the resulting package to my maven repository

I'd like to take things a step further. I have some post-build steps that I'm currently doing manually.

  1. Update the launch4j configuration xml file with the appropriate version
  2. Wrap the resulting jar in an executable using launch4j
  3. Copy the resulting EXE into a package directory
  4. Copy several supporting files into the package directory
  5. Zip the package directory up
  6. Email the package to my testers.

Eventually I'm going to have the additional task of building an installer leveraging the package directory.

I don't know that maven or ant are the right tools for automating my remaining 6 tasks, but it looks like either one or a combination of both could potentially accomplish what I need.

I could probably write a batch file or a simple perl script to do these things quicker than figuring out how to do them, but I would prefer to keep things as standard as possible so that I'm not taking on the additional responsibility of supporting a hack of a release process perpetually.

It seems to me that these are tasks that might not be standard part of build/release, but are commonly seen enough that there should be a best/most common practice for accomplishing them.

Was it helpful?

Solution

I would suggest to use the maven-assembly-plugin as well as the maven-launch4j-plugin during your build.

  1. Update the launch4j configuration xml file with the appropriate version

    put a placeholder into the configuration xml and let maven replace it during the the build.

  2. Wrap the resulting jar in an executable using launch4j

    use the launch4j-maven-plugin to create the executable.

  3. Copy the resulting EXE into a package directory

    I would suggest to put the resulting artifact into a repository manager instead of a separate folder, cause in Maven all artifacts are stored within a repository. It might be necessary to setup your own repository manager (Artifactory, Nexus, Archiva).

  4. Copy several supporting files into the package directory

    Using them as resources (src/main/resources) they will be copied automatically.

  5. Zip the package directory up

    Use the maven-assembly-plugin to create a resulting zip file.

  6. Email the package to my testers.

    You can use a CI like Jenkins etc. to send the final mail or you can take a look into maven-changes-plugin which might be solution.

This means all your mentioned steps can be handled by Maven during a usual build. This means in the end you can use the maven-release-plugin to produce a full release which contains all the above steps and produces all the wished artifacts.

OTHER TIPS

If I were you, I would try a combination of the following:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top