Maven plugin for creating .deb packages, creating control file, copyright file and transitively copying runtime dependencies.
Plugin is platform-independent and does not require additional external tools.
Requires java 8 and maven 3.3
Plugin is available from central maven repository. To use it, simply add the following to a the pom file.
<packaging>deb</packaging>
<build>
<plugins>
<plugin>
<groupId>io.solit.maven</groupId>
<artifactId>deb-maven-plugin</artifactId>
<version>1.0-RC2</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
pupulate
- transitively copy runtime dependencies to a specified directorydata
- copy files to a staging and control directoriescopyright
- create a machine readable copyright fileman
- compile a man pages from markdown source fileschangelog
- copy and/or convert changelog to debian formatpackage
- create a .deb file with control file
Projects with packaging deb
will produce a regular jar file as usual, but then will additionaly
pack it into a deb file along with transitive compile and runtime dependencies, and generated content
like changelogs and man pages. Source files by default are processed as follows (relative to project basedir):
changelog.md
will be converted to a changelogsrc/deb/doc/**/*.md
will be converted to a man page- content of
src/deb/data
will be recursively copied to a package root - content of
src/deb/control
will be recursively copied to a control section of a package
During this goal execution plugin will traverse all runtime dependencies of this project possibly applying filters to exclude some ot them.
Full configuration:
<configuration>
<dependencyDir></dependencyDir>
<packageName>${project.artifactId}</packageName>
<stageDir>${project.build.directory}/deb</stageDir>
<traverseExclusions>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<type></type>
<classifier></classifier>
</dependency>
</dependencies>
<pattern></pattern>
</traverseExclusions>
<packageExclusions>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<type></type>
<classifier></classifier>
</dependency>
</dependencies>
<pattern></pattern>
</packageExclusions>
</configuration>
dependencyDir
- directory to copy dependencies to; if unspecified<stageDir>/usr/share/<packageName>
will be usedpackageName
- name of a debian package; default is project artifact id; may be set usingdeb.name
system propertystageDir
- directory to stage files before package creation; default is ${project.build.directory}/debtraverseExclusions
- filter to exclude dependencies transitively from being processed; if dependency matches a filter it is excluded and it's transitive dependencies are not processeddependencies
- list of standard maven dependencies; only specified parameters are checked during filtering: specifying only a version will exclude all artifacts of that versionpattern
- a regular expression to check artifact string (groupId:artifactId:version[:classifier]) against
packageExclusions
- filter to exclude dependencies from being processed; if dependency matches a filter it is excluded but it's transitive dependencies are still processeddependencies
- list of standard maven dependencies; only specified parameters are checked during filtering: specifying only a version will exclude all artifacts of that versionpattern
- a regular expression to check artifact string (groupId:artifactId:version[:classifier]) against
Recursively copies files from a dataSourceDir
to a stageDir
and from controlSourceDir
to controlDir
.
If source directory does not exist, nothing will be copied, and plugin will finish correctly
Files are not overridden during this operation
Symbolic links are copied as is, without following them.
<configuration>
<dataSourceDir>${project.basedir}/src/deb/data</dataSourceDir>
<controlSourceDir>${project.basedir}/src/deb/control</controlSourceDir>
<stageDir>${project.build.directory}/deb</stageDir>
<controlDir>${project.build.directory}/control</controlDir>
</configuration>
dataSourceDir
- source directory, containing files to be included into a deb packagecontrolSourceDir
- source directory, containing files to be inclued into a control section of a deb packagesstageDir
- stage directory, containing files to be included into a deb packagecontrolDir
- stage directory, containing files to be inclued into a control section of a deb packages
Creates a machine-readable copyright file according to specification. May include copyright for dependencies copied into a package
Copyright information may be specified in a configuration or extracted from a pom file if no configuration present.
Copyright info is build based on a copyrightPatterns
parameter and gathered from a pom file if no
copyrightPatterns
specified:
- copyright is constructed from a copyright symbol,
inceptionYear
(if present), current year and holders:- project organisation, if present
- otherwise, project developers if present
- otherwise, project contributors if present
- otherwise
user.name
system property is used
- for project license
mainLicence
parameter is used if specified, otherwise first of project licenses is used; if no licenses present, project considered to be in a public domain.
If dependencyCopyrights
parameter is set to true, all dependencies filtered by traversalExclusions
and packageExclusions
are grouped by their copyright and licenses and included as a separate Files
paragraph. Copyright and license strings are constructed the same way as for this project
Full configuration:
<configuration>
<upstreamName></upstreamName>
<upstreamContact></upstreamContact>
<source></source>
<copyrightDisclaimer></copyrightDisclaimer>
<copyrightComment></copyrightComment>
<mainLicence></mainLicence>
<copyrightText></copyrightText>
<copyrightPatterns>
<copyrightPattern>
<files></files>
<copyright></copyright>
<licence></licence>
<licenceContent></licenceContent>
<comment></comment>
</copyrightPattern>
</copyrightPatterns>
<licesnces>
<licence>
<name></name>
<file></file>
<comment></comment>
</licence>
</licesnces>
<copyrightFile></copyrightFile>
<dependencyCopyrights></dependencyCopyrights>
<dependencyDir></dependencyDir>
<packageName>${project.artifactId}</packageName>
<stageDir>${project.build.directory}/deb</stageDir>
<traverseExclusions>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<type></type>
<classifier></classifier>
</dependency>
</dependencies>
<pattern></pattern>
</traverseExclusions>
<packageExclusions>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<type></type>
<classifier></classifier>
</dependency>
</dependencies>
<pattern></pattern>
</packageExclusions>
</configuration>
upstreamName
- upstream name of deb packageupstreamContact
- comma separated set of upstream contacts of deb packagesource
- url of upstream source codecopyrightDisclaimer
- disclaimer (no liability clause for instance)copyrightComment
- comment for a copyrightmainLicence
- licence to use for the project as a wholecopyrightText
- copyright for the project as a wholecopyrightPatterns
- file patterns to specify copyright for; each pattern includes:files
- mandatory set of glob patterns for a filecopyright
- mandatory copyright string eg Copyright 2018, Some Guylicence
- mandatory name of licenselicenceContent
- an optional licence textcomment
- an optional comment
licesnces
- licences to include into a copyright file; each licence consists ofname
- mandatory license namefile
- mandatory file, containing licence full textcomment
- optional comment
copyrightFile
- File to wright copyright to. If not specified<stageDir>/usr/share/doc/<packageName>/copyright
is useddependencyCopyrights
- whether to include copyrights for gathered dependenciesdependencyDir
- directory to copy dependencies to; if unspecified<stageDir>/usr/share/<packageName>
will be usedpackageName
- name of a debian package; default is project artifact id; may be set usingdeb.name
system propertystageDir
- directory to stage files before package creation; default is ${project.build.directory}/debtraverseExclusions
- filter to exclude dependencies transitively from being processed; if dependency matches a filter it is excluded and it's transitive dependencies are not processeddependencies
- list of standard maven dependencies; only specified parameters are checked during filtering: specifying only a version will exclude all artifacts of that versionpattern
- a regular expression to check artifact string (groupId:artifactId:version[:classifier]) against
packageExclusions
- filter to exclude dependencies from being processed; if dependency matches a filter it is excluded but it's transitive dependencies are still processeddependencies
- list of standard maven dependencies; only specified parameters are checked during filtering: specifying only a version will exclude all artifacts of that versionpattern
- a regular expression to check artifact string (groupId:artifactId:version[:classifier]) against
Goal generates linux man pages from markdown source. Generation process is similar to one used by
ruby-ronn
utility.
Goal processes every file in source directory with .md
extension (case-insensitive), and converts it to a
man page.
Files with other extensions are silently ignored.
Each processed file must contain a level one header specifying man title, section and short description used by man-db to generate apropos database. File content before header which follows this format will be ignored
For instance, the following code will create man page with title foo
in section 5
with short description
bar baz qux
# foo(5) - bar baz qux
======================
Other headers in file will be turned to a sections of man file, if header of level one or two, and to a subheader for other levels.
Generation supports, lists (including nested ones), definition lists, code blocks, quotes, emphasis and other markdown feature described in commonmark markdown specification.
For further details on markdown processing see man-markdown.md
<configuration>
<manSourceDirectory>${project.basedir}/src/deb/doc</manSourceDirectory>
<manDestinationDirectory></manDestinationDirectory>
<deduceManTitle>true</deduceManTitle>
<strictManParsing>false</strictManParsing>
<manSource></manSource>
<manName></manName>
<packageName>${project.artifactId}</packageName>
<stageDir>${project.build.directory}/deb</stageDir>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
-
manSourceDirectory
- directory to read markdown files for man page generation.
Only files with.md
(case-insensitive) will be processed.
Subdirectory structure will be preserved, with exception for.md
files in directory itself. Such files will be placed to a directory namedman[sectionNumber]
Defaults to${project.basedir}/src/deb/doc
-
manDestinationDirectory
- Directory to write generated man pages to.
Subdirectory structure of source directory will be preserved, with exception for.md
files in directory itself. Such files will be placed to a directory namedman[sectionNumber]
If not specified<stageDir>/usr/share/man
will be used. -
deduceManTitle
- Whether to try to create man title and description, if no proper heading found inside markdown file.
Title will be deduced the following way:- if file name matches
title.[number].md
pattern, thentitle
is used as man title, and[number]
as man section - else if file is in directory
man[number]
, than file name (without extension) is used as man title and,[number]
as man section - otherwise file name (without extension) is used as title and section is assumed to be
1
For short description required by man page specification combination of title and section name will be used
- if file name matches
-
strictManParsing
- Treat parser and validation warnings as failures and abort generation. -
manSource
- manual sources specified in a manual header. Package name will be used by default. -
manName
- manual name specified in a manual header. -
packageName
- name of debian package -
stageDir
- stage directory, containing files to be included into a deb package -
sourceEncoding
- encoding used to read source files
This goal creates and/or copies a changelog file as requested by debian policy
If copyOriginalChangelog
is set to true
, upstreamChangelogSource
file
will be gzipped and copied into changelogDestinationDirectory
as changelog.gz
If convertToDebianChangelog
is set, plugin will try to parse changelogSource
as
markdown file written according to keepachangelog.com recommendations and
write a changelog in a debian format as changelog.gz or as changelog.Debian.gz if
copyOriginalChangelog
is also set or current version has a revision part
Details on conversion process can be found in keepachangelog-markdown.md
<configuration>
<copyOriginalChangelog>false</copyOriginalChangelog>
<convertToDebianChangelog>true</convertToDebianChangelog>
<appendCurrentVersionChangeSet>true</appendCurrentVersionChangeSet>
<version>${project.version}</version>
<revision></revision>
<changelogSource>${project.basedir}/changelog.md</changelogSource>
<upstreamChangelogSource>${project.basedir}/changelog.md</upstreamChangelogSource>
<changelogDestinationDirectory></changelogDestinationDirectory>
<stageDir>${project.build.directory}/deb</stageDir>
<packageName>${project.artifactId}</packageName>
<maintainer>${project.developers[0].name}</maintainer>
<maintainerEmail>${project.developers[0].email}</maintainerEmail>
<targetDistribution>stable</targetDistribution>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
</configuration>
copyOriginalChangelog
- Whether to copy a gzipped original changelog to a destination folderconvertToDebianChangelog
- Whether to try parsing changelog and converting it to a form specified by debian policyappendCurrentVersionChangeSet
- if set to true, unreleased changes from a changelog file, will be added to a converted changelog as curren version change set. If changelog contains no unreleased changes and no changes for current version, yanked change set will be added to a generated changelogversion
- upstream part of a current package versionrevision
- revision part of a current package versionchangelogSource
- A source file for debian changelogupstreamChangelogSource
- A source file for upstream changelogchangelogDestinationDirectory
- Directory to write changelog to. If not specified<stageDir>/usr/share/doc/<packageName>
will be usedstageDir
- Stage directory, containing files to be included into a deb packagepackageName
- Name of debian packagemaintainer
- Package maintainer's namemaintainerEmail
- Package maintainer's email addresstargetDistribution
- A distribution to write to changelogsourceEncoding
- Encoding used to read source file
Create deb package with files situated in a stage dir.
This goal:
- creates control file based on configuration
- copies control files to a control archive, following present symlinks
- writes md5sums of present data files
- copies data files from a stage dir to a data archive, following present symlinks
- creates symbolic links based on a configuration
<configuration>
<maintainerScripts>preinst,postinst,prerm,postrm,config</maintainerScripts>
<stageDir>${project.build.directory}/deb</stageDir>
<controlDir>${project.build.directory}/control</controlDir>
<target></target>
<packageName>${project.artifactId}</packageName>
<version>${project.version}</version>
<revision></revision>
<maintainer>${project.developers[0].name}</maintainer>
<maintainerEmail>${project.developers[0].email}</maintainerEmail>
<architecture>all</architecture>
<synopsis>${project.name}</synopsis>
<description>${project.description}</description>
<homepage>${project.url}</homepage>
<permissions>
<permission>
<permissions></permissions>
<include></include>
<exclude></exclude>
</permission>
</permissions>
<packageAttributes>
<section></section>
<priority></priority>
<source></source>
<essential></essential>
<builtUsing></builtUsing>
<depends></depends>
<preDepends></preDepends>
<recommends></recommends>
<suggests></suggests>
<enhances></enhances>
<breaks></breaks>
<conflicts></conflicts>
<provides></provides>
</packageAttributes>
<symbolicLinks>
<symbolicLink>
<name></name>
<linkDestination></linkDestination>
</symbolicLink>
</symbolicLinks>
<autoDependencies>true</autoDependencies>
<autoPermissions>true</autoPermissions>
</configuration>
maintainerScripts
- names of control files to treat as maintainer scriptsstageDir
- directory to stage file to be packaged as a deb filecontrolDir
- directory to stage package control filestarget
- result .deb file; if not specified${project.build.directory}/<packageName>_<version>-<revision>_<architecture>.deb
is usedpackageName
- name of debian packageversion
- upstream part of a package versionrevision
- revision part of a package versionmaintainer
- package maintainer's namemaintainerEmail
- package maintainer's email addressarchitecture
- package architecturesynopsis
- short one-line package description, human readable namedescription
- detailed package descriptionhomepage
- project home pagepermissions
- permission changes to apply to packaged files:permissions
- octal permission (eg 600)include
- list of glob patterns to apply permissions change to (if omitted, all files assumed)exclude
- list of glob patterns to exclude from permission change, excludes have higher priority than includes
packageAttributes
- optional package control fieldssymbolicLinks
- symbolic links to create in a package data files; all fields should be specified for every link:name
- name of a link filelinkDestination
- name of a destination file (file man not exist)
autoDependencies
- if set to true, anddepends
field ofpackageAttributes
is not specified plugin will try to add dependencies automaticallyautoPermissions
- if set to true, andpermissions
are not specified plugin will try automatically mark files in /bin, /sbin, /usr/bin and /usr/sbin executable.