repository specification | reference | tutorial
In Maven, POM files are xml files containing the full definition of a project and how to build it. maven-repo-helper can manipulate them in order to clean unecessary cruft and integrate seamlessly in a Debian environment. mh_cleanpom: ~~~~~~~~~~~~~
Usage:
mh_cleanpom [option]... [pom] [target] [pom-props]
Cleans the POM and prepare it for inclusion in the Maven repository. Also extracts some information from the POM.
Where:
[pom] is the location of the POM file to clean. Default to pom.xml or debian/pom.xml [target] is where the cleaned POM is written to. Default to debian/tmp/pom.xml [pom-props] is where the POM properties file will be written. Default to debian/tmp/pom.properties
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this POM file -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages -o --no-parent: don't inherit from a parent POM -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins. If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously. This is useful in situations such as when the Maven clean target requires more dependencies or plugins to ignore than the build target. Optional, it is ignored by default -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles. -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
Cleans a Maven POM and prepare it for inclusion in the Debian repository for Maven.
The POM will be normalised, and its parent tag removed if the option --no-parent is given. The version will be replaced by 'debian', unless a special rule applies (see below the discussion about rules). Build, profiles and other build time only sections of the POM will be stripped.
If versions are given for a dependency, this version will be replaced by the 'debian' version, or a rule can be given to use a custom version.
You can modify those defaults with the help of the rules file. This file should contain the lines with the format:
<groupId> [artifactId] [type] [version] [classifier] [scope]
where groupId, artifactId, type, version, classifier and scope can be the explicit attribute to match, or can contain a wildcard (*) for generic matches.
Each one of those elements can also be a replace rule, of the form s/<regex>/<replace>/ where regex is a regular expression, and replace is the replacement. Substitution groups $1 $2... can be used in the replacement if capture groups () have been used in the regex.
The first element is mandatory (groupId), but you can ignore the elements on the right hand side. If the scope is missing, then any scope is matched and left unchanged. If the version missing, then any version will be replaced with 'debian'. If type is missing, then any type is matched and left unchanged. If artifactId is missing, then any artifactId is matched and left unchanged.
You can also have comments in this file, it should be a line starting with #
Example of a rules file:
s/commons-(.*)/org.apache.commons.commons$1/ org.itext * * s/1\..*/1.x/ org.itext * * s/2\..*/2.x/ # use the alpha version of plexus-container-default org.codehaus.plexus plexus-container-default jar s/1\.0-alpha.*/1.0-alpha/
This rules file does the following:
The default rule (* * * s/.*/debian/ *) replaces any version number with the 'debian' version and always applies last if there was no other matches. Another default rule (* * maven-plugin * *) keeps the version for all plugins as the plugin mechanism requires a version in Maven.
Any rules given on the command line (using -R/--extra-rule, -U/--extra-published-rule or -I/--extra-ignore-rule) are applied in the order given, in between the rules given in the rules file (if any) and the default rules.
This script is used by mh_installpom, normally you don't need to use it directly, except if you need to investigate an issue with the cleaning process for a POM file. mh_installpom: ~~~~~~~~~~~~~~~
Usage:
mh_installpom [option]... [pom]
Installs the POM file in /usr/share/maven-repo, at the correct location for Maven. Before installing the POM, it prepares it with mh_cleanpom.
Where:
[pom] is the location of the POM file to install. GroupId, artifactId and version will be extracted from this file.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this POM file -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages -o --no-parent: don't inherit from a parent POM -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins. If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously. This is useful in situations such as when the Maven clean target requires more dependencies or plugins to ignore than the build target. Optional, it is ignored by default -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles. --relocate=<groupId>:<artifactId>:<version>: relocate the specified artifact toward the one being installed. More than one relocation can be specified by separating them with a comma. -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results -ignore-pom: read the POM but don't install it
This script installs the POM file in /usr/share/maven-repo, at the correct location for Maven. Before installing the POM, it prepares it with mh_cleanpom.
debian/maven.rules is used to alter the version properties for the library and its dependencies.
Prefer to use mh_installpoms as it reuses the information defined in debian/$package.poms and avoids repetition. mh_installpoms: ~~~~~~~~~~~~~~~~
Usage:
mh_installpoms [option]...
Reads the file debian/$package.poms and installs each POM file listed in the .poms file. Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this POM file -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins. If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously. This is useful in situations such as when the Maven clean target requires more dependencies or plugins to ignore than the build target. Optional, it is ignored by default -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles. -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
debian/maven.rules is used to alter the version properties for the library and its dependencies.
The file debian/$package.poms should contain the relative paths to the POM files to install, each POM file in a separate line. After the path to the POM file, you can add options which will influence the cleaning of the POM file:
--ignore: ignore this POM and its artifact if any --no-parent: remove the <parent> tag from the POM --package=<package>: an alternative package to use when installing this POM and its artifact --has-package-version: to indicate that the original version of the POM is the same as the upstream part of the version for the package. --keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM during a clean operation with mh_cleanpom or mh\_installpom --artifact=<path>: path to the build artifact associated with this POM, it will be installed when using the command mh_install --java-lib: install the jar into /usr/share/java to comply with Debian packaging guidelines --usj-name=<name>: name to use when installing the library in /usr/share/java --usj-version=<version>: version to use when installing the library in /usr/share/java --no-usj-versionless: don't install the versionless link in /usr/share/java --dest-jar=<path>: the destination for the real jar it will be installed with mh_install. --classifier=<classifier>: Optional, the classifier for the jar. Empty by default. --ignore-pom: don't install the POM with mh\_install or mh\_installpoms. To use with POM files that are created temporarily for certain artifacts such as Javadoc jars.
For example, debian/$package.poms could contain:
pom.xml --no-parent --has-package-version module1/pom.xml --has-package-version --keep-elements=profiles,reporting // keep the profiles and reporting elements in the POM, as in this case they can be used from another place module2/pom.xml --package=mypackage-doc // package this POM and associated items into mypackage-doc package
Usage:
mh_patchpom [option]... [pom] [backup]
Patches one POM file using the Maven dependency rules.
Where:
[pom] is the location of the POM file to transform. Default to pom.xml [backup] is the backup file for the pom. Default to pom.xml.save
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package containing this library -o --no-parent: don't inherit from a parent POM -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins. If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously. This is useful in situations such as when the Maven clean target requires more dependencies or plugins to ignore than the build target. Optional, it is ignored by default -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules -d --debian-build: transform during a Debian build, which means that some POM elements will be removed -b --build-no-docs: if the build doesn't need to build documentation, use this option to remove some POM elements (in particular plugins) which are useless here and may require extra dependencies and make the packaging harder. -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
Usage:
mh_patchpoms [option]...
Reads the file debian/$package.poms and transforms each POM file listed in the .poms file into a POM file using the Debian versions of the libraries. Also keeps a backup of each POM file which can be restored with mh_unpatchpoms
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: package to act on -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins. If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously. This is useful in situations such as when the Maven clean target requires more dependencies or plugins to ignore than the build target. Optional, it is ignored by default -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules -d --debian-build: transform during a Debian build, which means that some POM elements will be removed -b --build-no-docs: if the build doesn't need to build documentation, use this option to remove some POM elements (in particular plugins) which are useless here and may require extra dependencies and make the packaging harder. -m\<repo root\>--maven-repo=\<repo root\>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
This script is used internally by maven-repo-helper when building packages with Maven. It is not usually used when Ant is used for the build. mh_unpatchpoms: ~~~~~~~~~~~~~~~~
Usage:
mh_unpatchpoms [option]...
Restore the POM files that have been patched to their original content.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: package to act on -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
maven-repo-helper provides tools to install a freshly built jar file into /usr/share/maven-repo, or to install a link into /usr/share/maven-repo for a jar installed into /usr/share/java or another location by another tool. mh_installjar: ~~~~~~~~~~~~~~~
Usage:
mh_installjar [option]... [pom] [jar] [link]...
Installs the jar file in /usr/share/maven-repo, at the correct location for Maven. Both the native version and the Debian version of the jar are installed. It can also create additional links to the jar, usually placed in /usr/share/java.
Where:
[pom] is the location of the POM associated with the jar to install. GroupId, artifactId and version will be extracted from this file. [jar] is the path to the jar to install, usually located in the build folder. [link] is an additional link to the jar to install, usually there should be a link to usr/share/java/.jar and usr/share/java/-.jar to comply with the Java packaging guidelines. Note that there is no need to specify those particular links if the --java-lib option is used.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this jar file -e<version>, --set-version=<version>: set the version for the jar, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules Maven rules are used here to extract the groupId, artifactId and version from the POM file. -l --java-lib: Optional, if given it will install the jar into /usr/share/java to comply with the Debian Java specification. The jar will be installed as /usr/share/java/\$name-\$version.jar and a versionless link /usr/share/java/\$name.jar will point to it, as well as the links installed in /usr/share/maven-repo -n<name> --usj-name=<name>: Optional, the name to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the artifact id found in the POM. -j<version> --usj-version=<version>: Optional, the version to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the version found in the POM. -s --no-usj-versionless: Optional, don't install the versionless link in /usr/share/java. This flag is used only when the -l or --java-lib option is given. -d<path> --dest-jar=<path>: Optional, the destination for the real jar. The other places where the jar appears, in the repository or in the list of links, will be symlinks to this jar. Defaults to /usr/share/java/$name-$version.jar if --java-lib is used, otherwise the jar is installed in the versioned path in the Maven repository. -c<classifier> --classifier=<classifier>: Optional, the classifier for the jar. Empty by default. -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options. mh_cleanpom is run only to extract the groupId, artifactId and version of the jar
Usage:
mh_linkjar [option]... [pom] [dest_jar] [link]...
Create symlinks for a jar installed by other means. The symlinks created include links to the jar in /usr/share/maven-repo, at the correct location for Maven. It can also create additional links to the jar, usually located in /usr/share/java.
Where:
[pom] is the location of the POM associated with the jar to install. GroupId, artifactId and version will be extracted from this file. [dest_jar] is the path of the installed jar, usually located in the usr/share/java folder. [link] is an additional link to the jar to install, usually there should be a link to usr/share/java/\$jar.jar and usr/share/java/\$jar-\$version.jar to comply with the Java packaging guidelines. Note that there is no need to specify those particular links if the --java-lib option is used.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain this jar file -e<version>, --set-version=<version>: set the version for the jar, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules Maven rules are used here to extract the groupId, artifactId and version from the POM file. -l --java-lib: Optional, if given it will install the jar into /usr/share/java to comply with the Debian Java specification. The jar will be installed as /usr/share/java/\$name-\$version.jar and a versionless link /usr/share/java/\$name.jar will point to it, as well as the links installed in /usr/share/maven-repo -n<name> --usj-name=<name>: Optional, the name to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the artifact id found in the POM. -i<version> --usj-version=<version>: Optional, the version to use when installing the library in /usr/share/java when --java-lib is used. Defaults to the version found in the POM. -s --no-usj-versionless: Optional, don't install the versionless link in /usr/share/java. This flag is used only when the -l or --java-lib option is given. -c<classifier> --classifier=<classifier>: Optional, the classifier for the jar. Empty by default. -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options. mh_cleanpom is run only to extract the groupId, artifactId and version of the jar
Usage:
mh_linkjars [option]...
Reads the file debian/$package.poms and create links for each jar file generated by a POM listed in the .poms file.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain the jar files -e<version>, --set-version=<version>: set the version for the jars, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
The .poms file should contain the list of POM files associated with the list of jars to install in the repository, and each pom file should have either the option --usj-name, giving the name of the jar (without the extension) to link to and located in /usr/share/java, or the option --artifact, which should contain the full name of the source jar to link to.
For example:
debian/pom.xml --usj-name=httpunit
or
debian/pom.xml --artifact=/usr/share/java/httpunit.jar
mh_linkjars is used also by jh_maven_repo_helper, the DH 7 plugin with complements javahelper by installing the jars and the POM metadata into the Debian Maven repository. mh_linkrepojar: ~~~~~~~~~~~~~~~~
TODO
DEPRECATED: Use debian/clean instead mh_installsite: ~~~~~~~~~~~~~~~~
Usage:
mh_installsite [option]... [pom] [site-file]
Installs the site.xml file in /usr/share/maven-repo, at the correct location for Maven.
Where:
[pom] is the location of the POM associated with the site.xml file to install. GroupId, artifactId and version will be extracted from this file. [site-file] is the location of the site.xml to install.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain the site file -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM. Optional, the default location is debian/maven.rules Maven rules are used here to extract the groupId, artifactId and version from the POM file. -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options. mh_cleanpom is run only to extract the groupId, artifactId and version of the jar
Usage:
mh_install [option]...
Reads the file debian/$package.poms and installs each POM file listed in the .poms file, as well as the associated jars - assuming that at least the --artifact option is given in the .poms file for all jars to install.
Options:
-h --help: show this text -V --version: show the version -p<package> --package=<package>: name of the Debian package which will contain all the files to install -e<version>, --set-version=<version>: set the version for all artifacts, do not use the version declared in the POM files. -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM files. Optional, the default location is debian/maven.rules -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM. Optional, the default location is debian/maven.publishedRules -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM. Optional, the default location is debian/maven.ignoreRules --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules -v --verbose: show more information while running -n --no-act: don't actually do anything, just print the results
The $package.poms file must contain enough information to locate the jar files to install, and to associate them with their POM file. For each POM file associated with a jar, we need to supply at least the --artifact parameter. For example:
maven-debian-helper.poms:
pom.xml --no-parent --has-package-version maven-debian-helper/pom.xml --has-package-version --artifact=maven-debian-helper/target/maven-debian-helper-*.jar --java-lib maven-debian-plugin/pom.xml --has-package-version --artifact=maven-debian-plugin/target/maven-debian-plugin-*.jar --java-lib maven-build-nodocs/pom.xml --has-package-version --artifact=maven-build-nodocs/target/maven-build-nodocs-*.jar --java-lib maven-packager-utils/pom.xml --has-package-version --artifact=maven-packager-utils/target/maven-packager-utils-*.jar --java-lib
Here we tell mh_install to deploy the maven-debian-helper project and its sub projects into /usr/share/maven-repo, and to deploy all jars also into /usr/share/java (--java-lib option)
Internally, mh_installpom is used to install the POM file, mh_installjar is used to install the jar if --artifact is supplied. If a project or sub-project contains the file src/site/site.xml, then it will be installed with mh_installsite.
The file $package.poms contains the list of POM files and their releated artifacts to install. The format of the $package.poms file is:
<path to pom file> [option]* <path to second pom file> [option]* [...]
where option can be:
--ignore: ignore this POM and its artifact if any --ignore-pom: don't install the POM. To use on POM files that are created temporarily for certain artifacts such as Javadoc jars. [mh_install, mh_installpoms] --no-parent: remove the <parent> tag from the POM --package=<package>: an alternative package to use when installing this POM and its artifact --has-package-version: to indicate that the original version of the POM is the same as the upstream part of the version for the package. --keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM during a clean operation with mh_cleanpom or mh_installpom --artifact=<path>: path to the build artifact associated with this POM, it will be installed when using the command mh_install. [mh_install] --java-lib: install the jar into /usr/share/java to comply with Debian packaging guidelines --usj-name=<name>: name to use when installing the library in /usr/share/java --usj-version=<version>: version to use when installing the library in /usr/share/java --no-usj-versionless: don't install the versionless link in /usr/share/java --dest-jar=<path>: the destination for the real jar. It will be installed with mh_install. [mh_install] --classifier=<classifier>: Optional, the classifier for the jar. Empty by default. --site-xml=<location>: Optional, the location for site.xml if it needs to be installed. Empty by default. [mh_install]
Checks the Maven repository for consistency and prints a report.
Where:
<location> is the location of the Maven repository. Default to /usr/share/maven-repo
Options:
-h --help: show this text -V --version: show the version -v --verbose: show more information while running -o<format>, --output=<format>: 'text' or 'html' to change output format -r<repository>, --repository=<repository>: directory of Maven repository
This DH 7 plugin uses the tools provided by the maven_repo_helper package to install the project jars and POM files into /usr/share/maven-repo. It uses the file(s) debian/$package.poms for its configuration, as well as the files debian/maven.rules, debian/maven.ignoreRules and debian/maven.publishedRules.
There can be several .poms file, one for each binary package if the source package builds multiple binary packages, each containing its own set of artifacts.
As --with maven_repo_helper plugin uses internally mh_install, the requirements for the configuration of the .poms files are the same, namely:
For each POM file associated with a jar, we need to supply at least the --artifact parameter. For example:
maven-debian-helper.poms:
pom.xml --no-parent --has-package-version maven-debian-helper/pom.xml --has-package-version --artifact=maven-debian-helper/target/maven-debian-helper-*.jar --java-lib maven-debian-plugin/pom.xml --has-package-version --artifact=maven-debian-plugin/target/maven-debian-plugin-*.jar --java-lib maven-build-nodocs/pom.xml --has-package-version --artifact=maven-build-nodocs/target/maven-build-nodocs-*.jar --java-lib maven-packager-utils/pom.xml --has-package-version --artifact=maven-packager-utils/target/maven-packager-utils-*.jar --java-lib
To use this plugin in the rules file, all you need to do is to add those lines to debian/rules:
%: dh $@ --buildsystem=ant --with maven_repo_helper
The option --buildsystem=ant is optional, and you can use any other build system or let DH 7 detect it, and you may add additional options to dh. --with jh_maven_repo_helper: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This DH 7 plugin uses the tools provided by the maven_repo_helper package to install the project jars and POM files into /usr/share/maven-repo. It uses the file(s) debian/$package.poms for its configuration, as well as the files debian/maven.rules, debian/maven.ignoreRules and debian/maven.publishedRules.
It is designed to work alongside javahelper, and requires the use of the javahelper plugin for DH 7 at the same time. To use this plugin in the rules file, all you need to do is to add those lines to debian/rules:
%: dh --with javahelper --with jh_maven_repo_helper $@
As for the plugin --with maven_repo_helper, you need to list the POM files and the artifacts to install in debian/$package.poms, but this is done in coordination with the configuration of javahelper. For example, if the .jlibs configuration for javahelper installs the httpunit.jar located in the lib folder into /usr/share/java,
libhttpunit-java.jlibs:
lib/httpunit.jar
Then we need to tell javahelper to install this httpunit.jar file from /usr/share/java into the Maven repository /usr/share/maven-repo
libhttpunit-java.poms:
debian/pom.xml --usj-name=httpunit