header

Documentation

See below for instruction on how to use jdeb with maven or ant. For developer information please see the javadocs and the source xref . For FAQs or other support please check the support website .

Howto use "jdeb" with maven

Generating a default Debian package with maven is particular easy. Just add the plugin to your POM like this

<build>
    <plugins>
        <plugin>
            <artifactId>jdeb</artifactId>
            <groupId>org.vafer</groupId>
            <version>0.7</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>deb</goal>
                    </goals>
                    <configuration>                        
                    </configuration>
                </execution>
            </executions>
        </plugin>

At least the one main control file is required to be present at src/deb/control/control . In contains the information for the Debian package descriptor. Usually it will look something along the lines of

Package: [[name]]
Version: [[version]]
Section: misc
Priority: optional
Architecture: all
Depends: jdk (>= 1.5)
Maintainer: Torsten Curdt <torsten@vafer.org>
Description: jetty java servlet container
Distribution: development

If the enviroment variables DEBEMAIL and DEBFULLNAME are both set this will overrule the Maintainer field set in there. The Installed-Size will also be injected. If a changes file is used, the Distribution usually comes from that file. The default changes file is called CHANGES.txt . See below for the syntax of the content. Now if you do a mvn clean install the attached deb goal is getting called and the artifacts -the deb and potentially the changes file- will automatically get attached to the project.

Howto use "jdeb" with ant

Attribute Description Required
destfile The debian package to be generated Yes
control The directory containing the control files Yes
compression Compression method for the data file (gzip , bzip2 or none ) No; defaults to gzip
verbose Print detailed info during the package generation No; defaults to false
keyring The file containing the PGP keys No
key The name of the key to be used in the keyring No
passphrase The passphrase to use the key No
changesIn The changes to add No
changesOut The changes file generated No
changesSave The merged changes file No

The jdeb Ant task can package up a directory as Debian package. You have to provide the control files defining meta information about the package (except the md5sums which gets created automatically). It creates the archive and if you want even a signed changes file.

<target name="package">
  <taskdef name="deb" classname="org.vafer.jdeb.ant.DebAntTask"/>

  <copy todir="${deb}/control">
    <fileset dir="src/main/resources/deb/control"/>
    <filterset begintoken="[[" endtoken="]]">
      <filter token="version" value="${version}"/>
      <filter token="name" value="${ant.project.name}"/>
    </filterset>
  </copy>
      
  <deb destfile="jdeb.deb" control="${deb}/control">
    <data src="src/main/resources/deb/data">
      <exclude name="**/.svn"/>
    </data>
  </deb>
</target>

For cross platform builds it might be important to retain permissions, ownerships and links. When you provide the original tar as input the meta data will be kept intact gets included directly into the deb. You can apply simple modifications like prefixing or stripping of paths though.

<deb destfile="jdeb.deb" control="${deb}/control">
  <data src="src/release.tgz">
    <mapper type="prefix" strip="1" prefix="/somewhere/else"/>
    <exclude name="**/.svn"/>
  </data>
</deb>

For more complex permission and ownership adjustments you can use a "ls" mapper. It allows you to define permissions and ownerships in a text file and even under Windows you will be able to build your debian package.

<deb destfile="jdeb.deb" control="${deb}/control">
  <data src="src/release.tgz">
    <mapper type="ls" src="mapping.txt" />
  </data>
</deb>

The mapper will apply the output of an "ls -laR > mapping.txt " command that should look like this

 ./trunk/target/test-classes/org/vafer/dependency:
 total 176
 drwxr-xr-x   23 tcurdt  tcurdt   782 Jun 25 03:48 .
 drwxr-xr-x    3 tcurdt  tcurdt   102 Jun 25 03:48 ..
 -rw-r--r--    1 tcurdt  tcurdt  2934 Jun 25 03:48 DependenciesTestCase.class
 -rw-r--r--    1 tcurdt  tcurdt  2176 Jun 25 03:48 WarTestCase.class
 drwxr-xr-x    4 tcurdt  tcurdt   136 Jun 25 03:48 classes

It's also possible to use a fileset or even a tarfileset to specify the set of files to include with their permissions :

<deb destfile="jdeb.deb" control="${deb}/control">
  <tarfileset dir="src/main/resources/deb/data"
           prefix="/somewhere/else"
         filemode="600"
         username="tcurdt"
            group="tcurdt"/>
</deb>

Changes file

In order to also create a changes file you will need to provide the input and output of the changes. The input file is a much simpler file where you should list your changes. Every change should be starting with the " * " and one line only.

 * changes for the next release
release distribution=staging, date=20:13 17.08.2007,version=1.4+r89114,urgency=low,by=Torsten Curdt <torsten@vafer.org>
 * debian changes support

When you do a release jdeb will add (or complete!) the release line and create a debian format standard changes file for you. (Don't forget to commit changes jdeb did to the file.) From Ant you have to call jdeb like this

<deb destfile="jdeb.deb" control="${deb}/control"
    changesIn="changes.txt"
   changesOut="jdeb.changes">
  <data src="some/dir"/>
</deb>

If you also provide a changesSave attribute the jdeb will add release information to the original input and write out the new file.

<deb destfile="jdeb.deb" control="${deb}/control"
    changesIn="changes.txt"
   changesOut="jdeb.changes"
  changesSave="changes.txt">
  <data src="some/dir"/>
</deb>

Signing changes

To have the changes be signed, make sure you have the bouncycastle jar in your classpath (just copy it into the $ANT_HOME/lib folder - next to jdeb). Then you can sign your changes file with

<deb destfile="jdeb.deb" control="${deb}/control"
    changesIn="changes.txt"
   changesOut="jdeb.changes"
          key="2E074D8F"
   passphrase="secret"
      keyring="/Users/tcurdt/.gnupg/secring.gpg">
  <data src="some/dir"/>
</deb>