AddMavenMetadata

What is needed is to modify the packaging of some of the existing packages (log4j, commons-codec, etc) to include their pom's as described in http://wiki.debian.org/Java/MavenRepoHelper

The list of packages that need work is currently:

package

owner

log4j

-

libcommons-attributes-java

-

libcommons-codec-java

-

libcommons-dbcp-java

-

libcommons-digester-java

-

libcommons-jxpath-java

-

commons-math

-

liblogkit-java

-

... and many others.

Add yourself as the owner in this page to avoid duplicating work.

To get started, you need some preparation:

First, add https://launchpad.net/~ludovicc/+archive/ppa/ to your sources.list, then

sudo apt-get refresh
sudo apt-get upgrade
sudo apt-get install maven-ant-helper maven-repo-helper

I have a collection of Bash scripts which I use a lot to simplify packaging. Install them in ~/Projects/bash-scripts for example, and add them to your ~/.bashrc

  1. bzr branch lp:~ludovicc/maven-packaging-support/bash-scripts ~/Projects/bash-scripts
  2. Add to ~/.bashrc at least the following

export PATH="${PATH}":~/Projects/bash-scripts
source dev-utils
source pkg-utils

Get the sources for the packages you want to work on. Use either

  1. apt-get sources libmypackage-java
  2. svn checkout http://svn.debian.org/svn/pkg-java/

Copy those sources onto your working folder. You will want also to keep track of changes with Bazaar, and publish them in your Launchpad account. I'm using a neat trick (http://code.mumak.net/2008/07/cool-launchpadbazaar-hack.html) to make the process simple when you're managing lots of small projects.

I have the following organization:

  • ~/Projects/onLaunchpad/uj/

This folder contains all the projects which are published under the uj (Ubuntu Java project) on Launchpad.

In ~/.bazaar/locations.conf, I have

[/home/ludo/Projects/onLaunchpad]
push_location = lp:~ludovicc/
push_location:policy = appendpath
public_branch = lp:~ludovicc/
public_branch:policy = appendpath

It is then possible to do something like:

cd ~/Projects/onLaunchpad/uj/
mkdir test
cd test
bzr init
touch test.txt
bzr add .
bzr commit -m "* Initial"
bzr push

The push command will create automatically a new branch on Launchpad under the uj project. Really cool!

Now that the setup is done, we can enhance the existing packages to include Maven metadata:

  1. Copy the project under the uj/ folder
  2. Run the following commands

# remove the svn information if the project was copied from svn
find . -name ".svn" -print | xargs rm -r
# remove the quilt information found in some projects
rm -rf .pc
bzr init
bzr add
pkg-bzr-init-merge
bzr commit -m "* Initial"
uscan --report --verbose

Use this command to increment the Debian version of the package in changelog:

  • dch -i

Append to the ubuntu version the ppa version, and use jaunty, for example you should have

  • ant (1.7.1-0ubuntu3~ppa3) jaunty; urgency=low

or if uscan reports a new upstream version, try to package it:

  • dch --newVersion=${upstream_version}-0ubuntu1~ppa1

Keep track of all changes done for the packaging in the changelog file.

Edit debian/control, and change the following: - change the section to java, this is to comply with the new Debian rules

  • Section: java

- update the standards version field

  • Standards-Version: 3.8.1

- on all Depends: fields, add

  • Depends: ${misc:Depends}

Execute those commands

pkg-get-orig-source
bzr bd-do
mh_genrules 
exit

Add to debian/rules, or merge debian/rules.new into debian/rules:

binary-post-install/lib$(PACKAGE)-java
  • mh_installpoms -plib$(PACKAGE)-java mh_installjar -plib$(PACKAGE)-java pom.xml build/$(PACKAGE)-*.jar usr/share/java/$(PACKAGE).jar usr/share/java/$(PACKAGE)-$(VERSION).jar

Add to changelog: (if you packaged a new version)

  • New upstream version, add myself to Uploaders

(if you did those changes)

  • Change section to java, bump up Standards-Version to 3.8.1

(if debhelper was 4 or less)

  • Bump up debhelper to 6
  • Add the Maven POM to the package
  • Add a Build-Depends-Indep dependency on maven-repo-helper
  • Use mh_installpom and mh_installjar to install the POM and the jar to the
    • Maven repository

(if you did those changes)

  • Remove the patch for the POM as it's no longer needed, as well as
    • the dependency on Quilt

(if you did those changes, check packages.qa.debian.org to see if a bug is opened against the package)

  • Change the build dependency on java-gcj to default-jdk (Closes: #xxxx)

(if you did those changes)

  • Add ${misc:Depends} to Depends to clear Lintian warnings

(if you did those changes)

  • Remove Depends on Java runtimes as it is a library

Execute those commands:

rm debian/rules.new
bzr add debian
bzr commit -m "* Added POM support"
b
sudo debi
pkg-upload
bzr push
# once you are happy that the package is ready to be deployed on your PPA
pkg-release

JavaTeam/AddMavenMetadata (last edited 2009-07-06 18:41:30 by bb-87-80-43-137)