[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using Maven to build Debian packages



On Mon, Apr 14, 2008 at 06:14:17PM +0100, Paul Cager wrote:
> I've been thinking about how we could use Maven within Debian package
> builds. Whichever way we go, I guess we'll need to package a lot of
> Maven's run-time dependencies - Plexus components, Maven plugins etc.
> (I've attached a list of what gets downloaded when running Maven against a
> simple "Hello World" project).
> 
> As a way to start discussion, here's how I would expect it to work. Any
> comments or corrections would be very welcome.
> 
> A new package, maven-deb-helper, will provide a number of tools to assist
> with the common tasks involved in building packages using Maven. The tools
> will generally be written in Java. The package will provide CDBS files (in
> /usr/share/cdbs) so that packages using Maven can be built as easily as
> packages using Ant.

Why pollute the space of another package? Why not develop a working
version and put that directly into the cdbs package?

> Building a Debian package using Maven
>  ====================================
> 
>   * Each build of a Debian package will use its own temporary, private
> local repository (e.g. ./debian/.m2/repository)
> 
>   * To keep things simple (for the first release at least), a
> configuration file for each package will define which Jars (and POMs)
> should be loaded into the local repository.
>     - It will be necessary to specify the maven artifact-id, version etc.
>     - Loading a Jar into the local repository could be done using the
> "install:file" target, or it might be easier to write our own utility.
>     - If the package requires a newer version of a dependency (compared to
> the one provided by debian), then an error should be raised.
>     - If a package requires an older version of a dependency then we will
> silently substitute the newer version (i.e. there is an implicit
> assumption that libraries are backwards-compatible). This is no worse
> than non-Maven packaging.
>     - It would be better if we could remove the need for the configuration
> file (e.g. by recursively parsing the POMs). Maybe in a later
> release...
> 
>   * maven-deb-helper can then create a settings.xml file in the build
> directory
>     - The settings.xml file should enable the "offline" and
> "non-interactive" flags, and specify the local repository location.
>     - It might be useful to write our own super-pom.
> 
>   * The Maven "package" target could then be invoked, passing the location
> of the settings.xml file (-s argument), and the resulting jar extracted
> from the target directory.

Fedora went a slightly different way. They patched Maven2 so they are
able to use /usr/share/maven2/repository as a host-wide repository. Each
mavenized package puts the needed data there for itself. When building
packages you just need to Build-Depends on the needed stuff and maven
will automatically pickup stuff from there.

The patches are in Fedora CVS (1). Should be very easy to adapt.

Paul: Can you please look into this and compare this to your solution?
You are more deep into maven and can better compare.


Cheers,
Michael


1: http://cvs.fedora.redhat.com/cgi-bin/viewcvs.cgi/rpms/maven2/


Reply to: