Ubuntu – How to create a PPA for a Maven project


I wanted to try creating my own PPA. The project I have is a java project built with maven. This is what I've already done so far:

  • Created a PPA.
  • Set up a new project on Launchpad.
  • Added a branch that is importing my project from a SVN repository.
  • Created a recipe for that branch that is publishing the builds to my PPA.

This is where I'm stuck.

I've read the tutorials and Googled a lot; but, I wasn't able to find out how to build my project.

I can start a build for the branch; but, as I expected, it fails. I guess I have to put some meta information like a makefile into the repository. Is it even possible to build and package Maven projects on Launchpad? I also tried to build a .deb file locally using bzr dh-make and debuild. bzr dh-make created a lot of files in the ./debian folder but debuild failed. I guess that it would work if I specified the right meta information in my project so it's the same problem as on Launchpad.

I know this is a pretty general question but I think there is a lack of proper tutorials for packaging .deb files even if you don't have an "exotic" case like me.

To sum it up:

What files/information do I have to provide in my project so that it can be properly build and packaged?

Any help would be great 🙂

Best Answer

Look in my bookjar project: http://code.google.com/p/bookjar/source/browse/

specifically the debian directory (especially the debian/package.sh file) and the build.xml (ant) file. In that file there is a new target 'upload' that uploads a buildable artefact to the launchpad buildbot.

I'm using ivy and the netbeans ant infrastructure so it's likely to be slightly different for you. However, one thing is certain: you can't use ivy or maven from the remote buildserver. You need to upload all libraries you use, either in the form of code or jars. ivy:retrive downloads the files to the current_dir/lib so my project in netbeans is setup to look for it's libraries there (nblibraries.properties is part of the netbeans infrastructure for that). Read the build.xml for details (basically the debian/rules files call a special ant target to build in the server that doesn't try to symlink the jar files - because they are already copied there).

I'm also taking advantage in my package.sh of my project being in mercurial to build a changelog file from the hg log, so there are other problems to solve if you want the same degree of automatism and don't use hg (in fact, i think that my changelog is bending the rules of debian changelogs by having each change be a 'minor' release).