Codebase list maven-debian-helper / 80b99ab
Merge branch 'arcticwaters/maven3' Emmanuel Bourg 8 years ago
41 changed file(s) with 370 addition(s) and 522 deletion(s). Raw diff Collapse all Expand all
22 MH_VERSION=$(ls /usr/share/maven-repo/org/debian/maven/maven-packager-utils/ | sed 's|/||')
33 . /usr/share/maven-repo-helper/mh_lib.sh
44
5 CLASSPATH="/usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar"
5 CLASSPATH="/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar"
66
77 syntax()
88 {
33 # line in a similar way as our cdbs snippets work. Production use is
44 # not supported by the maintainer of maven-debian-helper.
55
6 DEB_CLASSPATH=/usr/share/java/classworlds.jar
7 JAVA_OPTS=-Dclassworlds.conf=/etc/maven2/m2-debian.conf
6 DEB_CLASSPATH=/usr/share/java/plexus-classworlds2.jar
7 JAVA_OPTS=-Dclassworlds.conf=/etc/maven/m2-debian.conf
88 MAIN_CLASS=org.codehaus.classworlds.Launcher
9 MAVEN_OPTS=-s/etc/maven2/settings-debian.xml
9 MAVEN_OPTS=-s/etc/maven/settings-debian.xml
1010
1111 TMP_DIR=$(mktemp -d ${TMP:-/tmp}/mvn-deb.XXXXXXXXXX)
1212 /usr/share/maven-debian-helper/copy-repo.sh $TMP_DIR
0 build.directory=target
1 build.javaVersion=1.6
2 javadoc.dir=target/api
3 classpath.test=/usr/share/java/junit4.jar
40 maven.test.skip=true
51
+0
-67
debian/build.xml less more
0 <?xml version="1.0"?>
1
2 <project name="pkg-java" default="package" basedir="..">
3
4 <property file="debian/build.properties"/>
5 <property name="maven.build" value="/usr/share/maven-ant-helper/maven-build.xml"/>
6 <property file="/usr/share/maven-ant-helper/maven-defaults.properties"/>
7
8 <macrodef name="cleanmodule">
9 <attribute name="dir"/>
10 <sequential>
11 <ant target="clean" antfile="${maven.build}" dir="@{dir}">
12 <property name="debian.dir" location="debian" />
13 <property name="project.dir" value="@{dir}" />
14 </ant>
15 </sequential>
16 </macrodef>
17
18 <macrodef name="packagemodule">
19 <attribute name="dir"/>
20 <sequential>
21 <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
22 <property name="debian.dir" location="debian" />
23 <property name="project.dir" value="@{dir}" />
24 <property name="keep-cleaned-pom" value="true" />
25 </ant>
26 </sequential>
27 </macrodef>
28
29 <macrodef name="package-plugin-module">
30 <attribute name="dir"/>
31 <sequential>
32 <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
33 <property name="debian.dir" location="debian" />
34 <property name="project.dir" value="@{dir}" />
35 <property name="maven.generate.target" value="plugin:descriptor" />
36 <property name="keep-cleaned-pom" value="true" />
37 <property name="use-local-repo" value="true" />
38 </ant>
39 </sequential>
40 </macrodef>
41
42 <target name="clean">
43 <cleanmodule dir=""/>
44 <cleanmodule dir="maven-debian-helper"/>
45 <cleanmodule dir="debian-maven-plugin"/>
46 <cleanmodule dir="maven-build-nodocs"/>
47 <cleanmodule dir="maven-packager-utils"/>
48 </target>
49
50 <target name="package">
51 <packagemodule dir=""/>
52 <packagemodule dir="maven-debian-helper"/>
53 <packagemodule dir="maven-build-nodocs"/>
54 <package-plugin-module dir="debian-maven-plugin"/>
55 <package-plugin-module dir="maven-packager-utils"/>
56 </target>
57
58 <target name="javadoc">
59 <javadoc destdir="${javadoc.dir}">
60 <packageset dir="maven-debian-helper/src/main/java/"/>
61 <packageset dir="debian-maven-plugin/src/main/java/"/>
62 <packageset dir="maven-packager-utils/src/main/java/"/>
63 </javadoc>
64 </target>
65
66 </project>
0 maven-debian-helper (2.0) UNRELEASED; urgency=medium
1
2 * Update Maven to version 3.0.5
3 * Build deb package using itself rather than maven-ant-helper
4 * Update mojos to use annotations
5 * Remove nodocs build due to Maven 3 update
6
7 -- Andrew Schurman <arcticwaters@gmail.com> Mon, 16 Mar 2015 18:48:32 -0700
8
09 maven-debian-helper (1.7) unstable; urgency=medium
110
211 * Ignore the 'maven clean' errors when building with debhelper
77 Thomas Koch <thomas@koch.ro>,
88 Emmanuel Bourg <ebourg@apache.org>,
99 Wolodja Wentland <debian@babilen5.org>
10 Build-Depends: cdbs, debhelper (>= 9), default-jdk, maven-ant-helper (>= 7.0), ant-optional, help2man
10 Build-Depends: cdbs, debhelper (>= 9), default-jdk, help2man
1111 Build-Depends-Indep: junit4,
1212 libcommons-io-java,
13 libmaven-install-plugin-java,
1314 libmaven-plugin-tools-java,
1415 libplexus-velocity-java,
1516 maven-repo-helper (>= 1.8.9)
2021
2122 Package: maven-debian-helper
2223 Architecture: all
23 Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.8.9), maven2 (>= 2.2.1-5),
24 Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.8.9), maven (>= 3.0.5-1),
2425 libmaven-clean-plugin-java,
25 libmaven-compiler-plugin-2.5-java | libmaven-compiler-plugin-java (<< 3.0~),
26 libmaven-compiler-plugin-java,
2627 libmaven-jar-plugin-java,
2728 libmaven-resources-plugin-java,
2829 libmaven-site-plugin-java,
2930 libplexus-velocity-java,
3031 libsurefire-java,
31 velocity
32 libxml2-utils,
33 velocity,
34 unzip
3235 Suggests: libmaven-javadoc-plugin-java, apt-file, devscripts, subversion
3336 Description: Helper tools for building Debian packages with Maven
3437 maven-debian-helper is a set of tools used to generate Debian packages from
00 bin/mh_* /usr/bin
11 bin/mvn-debian /usr/bin
2 etc/*.conf /etc/maven2/
3 etc/*.xml /etc/maven2/
2 etc/*.conf /etc/maven/
3 etc/*.xml /etc/maven/
44 share/cdbs/1/class/*.mk /usr/share/cdbs/1/class
55 share/maven-debian-helper/*.sh /usr/share/maven-debian-helper
66 usr/share/perl5
00 pom.xml --no-parent --has-package-version
11 maven-debian-helper/pom.xml --has-package-version --artifact=maven-debian-helper/target/maven-debian-helper-*.jar --java-lib
22 debian-maven-plugin/pom.xml --has-package-version --artifact=debian-maven-plugin/target/debian-maven-plugin-*.jar --java-lib
3 maven-build-nodocs/pom.xml --has-package-version --artifact=maven-build-nodocs/target/maven-build-nodocs-*.jar --java-lib
43 maven-packager-utils/pom.xml --has-package-version --artifact=maven-packager-utils/target/maven-packager-utils-*.jar --java-lib
00 junit junit jar s/4\..*/4.x/
1 org.codehaus.plexus plexus-container-default jar s/1\.0-alpha-.*/1.0-alpha/
1 org.apache.maven maven-embedder * s/3\..*/3.x/
00 #!/usr/bin/make -f
11
2 ROOT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/..
3 # ensure that maven.mk is able to include necessary files
4 _cdbs_class_path = $(ROOT_DIR)/share/cdbs/1/class
5
26 include /usr/share/cdbs/1/rules/debhelper.mk
3 include /usr/share/cdbs/1/class/ant.mk
7 include $(ROOT_DIR)/share/cdbs/1/class/maven.mk
48
59 PACKAGE := $(DEB_SOURCE_PACKAGE)
610 VERSION := $(shell echo ${DEB_UPSTREAM_VERSION} | sed -r 's/([0-9\.]+).*/\1/')
711 JAVA_HOME := /usr/lib/jvm/default-java
8 DEB_JARS := ant-junit junit commons-io classworlds maven-core maven-artifact maven-artifact-manager maven-model \
9 maven-compat maven-plugin-api maven-project maven-scm-api velocity file-management plexus-utils \
10 plexus-container-default-alpha maven-repo-helper
11 DEB_ANT_BUILD_TARGET := package #javadoc
12 DEB_ANT_BUILDFILE := debian/build.xml
13 DEB_ANT_ARGS := -Dpackage=$(PACKAGE) -Dbin.package=$(PACKAGE)
14 API_DOCS := target/api
12 MAVEN_CLASSCONF_ORIG := $(ROOT_DIR)/etc/m2-debian.conf
13 MAVEN_CLASSCONF_REAL := $(ROOT_DIR)/debian/.mh/etc/m2-debian.conf
14 MAVEN_CLASSCONF := $(MAVEN_CLASSCONF_REAL)
15 MAVEN_SETTINGS := $(ROOT_DIR)/etc/settings-debian.xml
16 DEB_MAVEN_PROPERTYFILE:= $(ROOT_DIR)/debian/build.properties
17 DEB_MAVEN_SCRIPT_DIR := $(ROOT_DIR)/share/maven-debian-helper/
18
19
20 # clean happens before we get a chance to bootstrap (and we don't need sugar yet)
21 clean:: override MAVEN_CLASSCONF=/etc/maven/m2.conf
22 clean:: override JAVA_OPTS+="-Dmaven.home=$(MAVEN_HOME)"
23
24 # bootstrap the build process
25 before-mvn-build:: override MAVEN_CLASSCONF=/etc/maven/m2.conf
26 before-mvn-build:: override JAVA_OPTS+="-Dmaven.home=$(MAVEN_HOME)"
27 before-mvn-build::
28 $(DEB_MAVEN_INVOKE) -Dmaven.test.skip -Djar.finalName=maven-debian-helper install
29 cp maven-debian-helper/target/maven-debian-helper.jar debian/.mh/
30 sed 's|load .*/maven-debian-helper.jar|load $(ROOT_DIR)/debian/.mh/maven-debian-helper.jar|g' $(MAVEN_CLASSCONF_ORIG) > $(MAVEN_CLASSCONF_REAL)
31 $(DEB_MAVEN_INVOKE) clean
32
1533
1634 debian/.mh:
1735 mkdir -p debian/.mh
5876 # Helper target, to use when updating the version of this package
5977 update-package-version:
6078 perl -p -i -e "s/^ <version>([0-9\.]+<)/ <version>${VERSION}</" pom.xml
61 perl -p -i -e "s/^ <version>([0-9\.]+<)/ <version>${VERSION}</" maven-build-nodocs/pom.xml maven-debian-helper/pom.xml debian-maven-plugin/pom.xml
79 perl -p -i -e "s/^ <version>([0-9\.]+<)/ <version>${VERSION}</" maven-debian-helper/pom.xml debian-maven-plugin/pom.xml
6280 perl -p -i -e "s/maven-debian-helper \(>= ([0-9\.]+)\)/maven-debian-helper \(>= ${VERSION})/" share/cdbs/1/class/maven-vars.mk maven-packager-utils/src/main/resources/control.vm
6381
6482
55 <parent>
66 <artifactId>maven-debian</artifactId>
77 <groupId>org.debian.maven</groupId>
8 <version>1.7</version>
8 <version>2.0</version>
99 </parent>
1010
1111 <artifactId>debian-maven-plugin</artifactId>
1818 <artifactId>maven-repo-helper</artifactId>
1919 </dependency>
2020 <dependency>
21 <groupId>commons-io</groupId>
22 <artifactId>commons-io</artifactId>
23 <scope>test</scope>
21 <groupId>org.apache.maven</groupId>
22 <artifactId>maven-core</artifactId>
23 </dependency>
24 <dependency>
25 <groupId>junit</groupId>
26 <artifactId>junit</artifactId>
27 </dependency>
28 <dependency>
29 <groupId>org.apache.maven.plugin-tools</groupId>
30 <artifactId>maven-plugin-annotations</artifactId>
2431 </dependency>
2532 </dependencies>
2633 </project>
1717
1818 import java.io.File;
1919
20 import org.apache.maven.plugins.annotations.Mojo;
21 import org.apache.maven.plugins.annotations.Parameter;
22
2023 /**
2124 * Install the javadoc jar files into the debian/ directory
2225 *
2326 * @author Ludovic Claude
24 * @goal install-doc
2527 */
28 @Mojo(name = "install-doc")
2629 public class InstallDocMojo extends SysInstallDocMojo {
2730
2831 /**
2932 * Maven repository root
30 *
31 * @parameter expression="${maven.repo.local}"
3233 */
34 @Parameter(property = "maven.repo.local")
3335 private File mavenRepoLocal;
3436
3537 /**
3638 * If true, use local Maven repository for installation
37 *
38 * @parameter expression="${use.maven.repo.local}"
3939 */
40 @Parameter(property = "use.maven.repo.local")
4041 private boolean useMavenRepoLocal;
4142
4243 // ----------------------------------------------------------------------
1717
1818 import java.io.File;
1919
20 import org.apache.maven.plugins.annotations.Mojo;
21 import org.apache.maven.plugins.annotations.Parameter;
22
2023 /**
2124 * Install pom and jar files into the debian/ directory
22 *
23 * @goal install
2425 */
26 @Mojo(name = "install")
2527 public class InstallMojo extends SysInstallMojo {
2628
2729 /**
2830 * Maven repository root
29 *
30 * @parameter expression="${maven.repo.local}"
3131 */
32 @Parameter(property = "maven.repo.local")
3233 private File mavenRepoLocal;
3334
3435 /**
3536 * If true, use local Maven repository for installation
36 *
37 * @parameter expression="${use.maven.repo.local}"
3837 */
38 @Parameter(property = "use.maven.repo.local")
3939 private boolean useMavenRepoLocal;
4040
4141 // ----------------------------------------------------------------------
1515
1616 package org.debian.maven.plugin;
1717
18 import org.apache.maven.plugins.annotations.Mojo;
19 import org.apache.maven.plugins.annotations.ResolutionScope;
20
1821 /**
1922 * Resolves compile dependencies
20 *
21 * @goal resolve-compile
22 * @requiresDependencyResolution compile
23 * @aggregator true
2423 */
24 @Mojo(name = "resolve-compile", aggregator = true, requiresDependencyResolution = ResolutionScope.COMPILE)
2525 public class ResolveCompileMojo extends ResolveNoneMojo
2626 {
2727 }
1717
1818 import org.apache.maven.plugin.AbstractMojo;
1919 import org.apache.maven.plugin.MojoExecutionException;
20 import org.apache.maven.plugins.annotations.Mojo;
2021
2122 /**
2223 * Dummy goal that just reads the pom.xml files including parents
23 *
24 * @goal resolve-none
25 * @aggregator true
2624 */
25 @Mojo(name = "resolve-none", aggregator = true)
2726 public class ResolveNoneMojo extends AbstractMojo {
2827
2928 public void execute() throws MojoExecutionException {
1515
1616 package org.debian.maven.plugin;
1717
18 import org.apache.maven.plugins.annotations.Mojo;
19 import org.apache.maven.plugins.annotations.ResolutionScope;
20
1821 /**
1922 * Resolves runtime dependencies
20 *
21 * @goal resolve-runtime
22 * @requiresDependencyResolution runtime
23 * @aggregator true
2423 */
24 @Mojo(name = "resolve-runtime", aggregator = true, requiresDependencyResolution = ResolutionScope.RUNTIME)
2525 public class ResolveRuntimeMojo extends ResolveNoneMojo
2626 {
2727 }
1515
1616 package org.debian.maven.plugin;
1717
18 import org.apache.maven.plugins.annotations.Mojo;
19 import org.apache.maven.plugins.annotations.ResolutionScope;
20
1821 /**
1922 * Resolves test dependencies
20 *
21 * @goal resolve-test
22 * @requiresDependencyResolution test
23 * @aggregator true
2423 */
24 @Mojo(name = "resolve-test", aggregator = true, requiresDependencyResolution = ResolutionScope.TEST)
2525 public class ResolveTestMojo extends ResolveNoneMojo
2626 {
2727 }
1717
1818 import java.io.IOException;
1919
20 import org.apache.maven.plugins.annotations.Mojo;
21
2022 /**
2123 * Install the javadoc jar.
2224 *
2325 * @author Ludovic Claude
24 * @goal sysinstall-doc
2526 */
27 @Mojo(name = "sysinstall-doc")
2628 public class SysInstallDocMojo extends SysInstallMojo {
2729
2830 {
2525
2626 import org.apache.maven.plugin.AbstractMojo;
2727 import org.apache.maven.plugin.MojoExecutionException;
28 import org.apache.maven.plugins.annotations.Mojo;
29 import org.apache.maven.plugins.annotations.Parameter;
2830 import org.codehaus.plexus.util.FileUtils;
2931 import org.debian.maven.repo.ListOfPOMs;
3032 import org.debian.maven.repo.POMCleaner;
3234
3335 /**
3436 * Install pom and jar files into the /usr/share/hierarchy
35 *
36 * @goal sysinstall
3737 */
38 @Mojo(name = "sysinstall")
3839 public class SysInstallMojo extends AbstractMojo {
3940
4041 /** Regex for detecting that package is a libXXX-java package */
4950
5051 /**
5152 * groupId
52 *
53 * @parameter expression="${project.groupId}"
54 * @required
55 * @readonly
56 */
53 */
54 @Parameter(property = "project.groupId", required = true, readonly = true)
5755 private String groupId;
5856
5957 /**
6058 * artifactId
61 *
62 * @parameter expression="${project.artifactId}"
63 * @required
64 * @readonly
65 */
59 */
60 @Parameter(property = "project.artifactId", required = true, readonly = true)
6661 private String artifactId;
6762
6863 /**
6964 * destGroupId
70 *
71 * @parameter expression="${project.groupId}"
72 * @required
73 */
65 */
66 @Parameter(property = "project.groupId", required = true)
7467 private String destGroupId;
7568
7669 /**
7770 * destArtifactId
78 *
79 * @parameter expression="${project.artifactId}"
80 * @required
81 */
71 */
72 @Parameter(property = "project.artifactId", required = true)
8273 private String destArtifactId;
8374
8475 /**
8576 * version
86 *
87 * @parameter expression="${project.version}"
88 * @required
89 * @readonly
90 */
77 */
78 @Parameter(property = "project.version", required = true, readonly = true)
9179 private String version;
9280
9381 /**
9482 * debianVersion
95 *
96 * @parameter
97 */
83 */
84 @Parameter
9885 private String debianVersion;
9986
10087 /**
10188 * directory where the current pom.xml can be found
102 *
103 * @parameter expression="${basedir}"
104 * @required
105 * @readonly
106 */
89 */
90 @Parameter(property = "basedir", required = true, readonly = true)
10791 private File basedir;
10892
10993 /**
11094 * directory of the jar file
111 *
112 * @parameter expression="${project.build.directory}"
113 * @required
114 * @readonly
115 */
95 */
96 @Parameter(property = "project.build.directory", required = true, readonly = true)
11697 private String jarDir;
11798
11899 /**
119100 * finalname of the artifact
120 *
121 * @parameter expression="${project.build.finalName}"
122 * @required
123 * @readonly
124 */
101 */
102 @Parameter(property = "project.build.finalName", required = true, readonly = true)
125103 private String finalName;
126104
127105 /**
128106 * Debian directory
129 *
130 * @parameter expression="${debian.dir}"
131 */
107 */
108 @Parameter(property = "debian.dir")
132109 private File debianDir;
133110
134111 /**
135112 * Debian package (send from command line)
136 *
137 * @parameter expression="${debian.package}"
138 */
113 */
114 @Parameter(property = "debian.package")
139115 private String debianPackage;
140116
141117 /**
142118 * Debian package destination (set by xxx.poms file).
143119 * By default, equals to <code>debianPackage</code> attribute.
144 *
145 * @parameter expression="${debian.package}"
146 */
120 */
121 @Parameter(property = "debian.package")
147122 private String destPackage;
148123
149 /**
150 * @parameter expression="${maven.rules}" default-value="maven.rules"
151 * @required
152 */
124 @Parameter(property = "maven.rules", defaultValue = "maven.rules", required = true)
153125 private String mavenRules;
154126
155 /**
156 * @parameter expression="${maven.ignoreRules}" default-value="maven.ignoreRules"
157 * @required
158 */
127 @Parameter(property = "maven.ignoreRules", defaultValue = "maven.ignoreRules", required = true)
159128 private String mavenIgnoreRules;
160129
161 /**
162 * @parameter expression="${maven.publishedRules}" default-value="maven.publishedRules"
163 * @required
164 */
130 @Parameter(property = "maven.publishedRules", defaultValue = "maven.publishedRules", required = true)
165131 private String mavenPublishedRules;
166132
167133 /**
168134 * root directory of the Maven repository
169 *
170 * @parameter expression="${basedir}"
171 * @readonly
172 */
135 */
136 @Parameter(defaultValue = "${basedir}", readonly = true)
173137 private File repoDir;
174138
175139 /**
176140 * Install the jar to /usr/share/java if true. Default is true
177 *
178 * @parameter expression="${install.to.usj}" default-value="true"
179 */
141 */
142 @Parameter(property = "install.to.usj", defaultValue = "true")
180143 private boolean installToUsj = true;
181144
182145 /**
570533 * command for creating the relative symlink
571534 */
572535 private void link(String target, String linkName) throws IOException {
536 Process process;
573537 if (System.getProperty("os.name").contains("Windows")) {
574538 File linkNameFile = new File(linkName).getAbsoluteFile();
575539 linkNameFile.getParentFile().mkdirs();
576 Process process = new ProcessBuilder().command("cmd", "/C", "mklink", linkNameFile.getAbsolutePath(), target.replace('/', '\\')).start();
577 try {
578 process.waitFor();
579 } catch (InterruptedException e) {
580 throw new IOException(e);
581 }
540 process = new ProcessBuilder().command("cmd", "/C", "mklink", linkNameFile.getAbsolutePath(), target.replace('/', '\\')).start();
582541 } else {
583 Runtime.getRuntime().exec(new String[]{"ln", "-s", target, linkName}, null);
542 process = new ProcessBuilder().command("ln", "-s", target, linkName).start();
543 }
544
545 try {
546 process.waitFor();
547 } catch (InterruptedException e) {
548 throw new IOException(e);
584549 }
585550 }
586551
1717
1818 import java.io.IOException;
1919
20 import org.apache.maven.plugins.annotations.Mojo;
2021 import org.codehaus.plexus.util.FileUtils;
2122
2223 /**
2324 * Remove installed files and symlinks from the /usr/share hierarchy
24 *
25 * @goal sysuninstall
2625 */
26 @Mojo(name = "sysuninstall")
2727 public class SysUninstallMojo extends SysInstallMojo {
2828 // ----------------------------------------------------------------------
2929 // Mojo parameters
1515
1616 package org.debian.maven.plugin;
1717
18 import static org.junit.Assert.assertEquals;
19
1820 import org.junit.Test;
19
20 import static junit.framework.Assert.assertEquals;
2121
2222 public class DirectoryUtilsTest {
2323
1515
1616 package org.debian.maven.plugin;
1717
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20
21 import java.io.File;
22 import java.io.IOException;
23 import java.net.URISyntaxException;
24 import java.net.URL;
25
26 import org.codehaus.plexus.util.FileUtils;
1827 import org.junit.After;
1928 import org.junit.Before;
2029 import org.junit.Test;
2130
22 import java.io.File;
23 import java.io.IOException;
24 import java.io.Reader;
25 import java.net.URISyntaxException;
26 import java.net.URL;
27 import java.util.ArrayList;
28 import java.util.List;
29 import java.util.logging.Level;
30 import java.util.logging.Logger;
31 import org.apache.commons.io.FileUtils;
32
33 import static junit.framework.Assert.assertEquals;
34 import static junit.framework.Assert.assertNotNull;
3531
3632 public class InstallMojoTest {
37
3833 private File testDir = new File("tmp");
3934 private InstallMojo mojo;
4035
+0
-8
etc/m2-debian-nodocs.conf less more
0 main is org.debian.maven.Wrapper from debian
1
2 set maven.home default /usr/share/maven2
3
4 [debian]
5 load /usr/share/java/maven-debian-helper.jar
6 load /usr/share/java/maven-build-nodocs.jar
7 load ${maven.home}/lib/*.jar
00 main is org.debian.maven.Wrapper from debian
11
2 set maven.home default /usr/share/maven2
2 set maven.home default /usr/share/maven
33
44 [debian]
55 load /usr/share/java/maven-debian-helper.jar
6 optionally ${maven.home}/lib/ext/*.jar
67 load ${maven.home}/lib/*.jar
+0
-20
maven-build-nodocs/pom.xml less more
0 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2 <modelVersion>4.0.0</modelVersion>
3
4 <parent>
5 <groupId>org.debian.maven</groupId>
6 <artifactId>maven-debian</artifactId>
7 <version>1.7</version>
8 </parent>
9
10 <artifactId>maven-build-nodocs</artifactId>
11 <packaging>jar</packaging>
12 <name>build with no docs patch for Maven</name>
13
14 <description>
15 Patch to prevent Maven from calling maven-site-plugin when
16 we run a build that does not need to produce any documentation
17 </description>
18
19 </project>
+0
-48
maven-build-nodocs/src/main/resources/META-INF/plexus/components.xml less more
0 <!--
1 Licensed to the Apache Software Foundation (ASF) under one
2 or more contributor license agreements. See the NOTICE file
3 distributed with this work for additional information
4 regarding copyright ownership. The ASF licenses this file
5 to you under the Apache License, Version 2.0 (the
6 "License"); you may not use this file except in compliance
7 with the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing,
12 software distributed under the License is distributed on an
13 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 KIND, either express or implied. See the License for the
15 specific language governing permissions and limitations
16 under the License.
17 -->
18
19 <component-set>
20 <components>
21
22 <component>
23 <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
24 <role-hint>pom</role-hint>
25 <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
26 <configuration>
27 <lifecycles>
28 <lifecycle>
29 <id>default</id>
30 <!-- START SNIPPET: pom-lifecycle -->
31 <phases>
32 <package></package>
33 <install>org.apache.maven.plugins:maven-install-plugin:install</install>
34 <deploy></deploy>
35 </phases>
36 <!--optional-mojos>
37 <optional-mojo>org.apache.maven.plugins:maven-site-plugin:attach-descriptor</optional-mojo>
38 </optional-mojos-->
39 <!-- END SNIPPET: pom-lifecycle -->
40 </lifecycle>
41 </lifecycles>
42 </configuration>
43 </component>
44
45 </components>
46
47 </component-set>
44 <parent>
55 <groupId>org.debian.maven</groupId>
66 <artifactId>maven-debian</artifactId>
7 <version>1.7</version>
7 <version>2.0</version>
88 </parent>
99
1010 <artifactId>maven-debian-helper</artifactId>
1313
1414 <dependencies>
1515 <dependency>
16 <groupId>classworlds</groupId>
17 <artifactId>classworlds</artifactId>
16 <groupId>org.codehaus.plexus</groupId>
17 <artifactId>plexus-classworlds</artifactId>
18 </dependency>
19 <dependency>
20 <groupId>org.apache.maven</groupId>
21 <artifactId>maven-embedder</artifactId>
1822 </dependency>
1923 </dependencies>
2024 </project>
2020 import java.util.Enumeration;
2121 import java.util.Properties;
2222
23 import org.apache.maven.cli.compat.CompatibleMain;
24 import org.codehaus.classworlds.ClassWorld;
23 import org.apache.maven.cli.MavenCli;
24 import org.codehaus.plexus.util.IOUtil;
2525
2626 /**
27 * This is a wrapper for Maven's main function that reads 2 property
28 * files: debian/auto.properties and debian/manual.properties and adds
29 * their content to maven's commandline.
27 * This is a wrapper for Maven's main function that allows extra arguments
28 * to be specified by a properties file. Properties are read from the file
29 * specified by the system property {@value #EXTRA_PROPERTIES_PROPERTY}.
3030 */
3131 public class Wrapper {
32
33 /** Holds extra properties that are read from property files */
34 private static Properties extraProperties = new Properties();
35
36 /** The extended command line for maven's main function */
37 private static String[] newArgs;
38
39 /**
40 * Opens the filename specified by property 'key' and loads its
41 * properties into extraProperties
32 private static final String EXTRA_PROPERTIES_PROPERTY = "properties.file.manual";
33
34 /**
35 * Reads the properties in the file specified by the given system property.
36 *
37 * @param property system property that specifies the location of the properties file
38 * @return {@link Properties} provided by the file
4239 */
43 public static void updateProperties(String key) throws IOException {
44 String filename = System.getProperty(key);
40 public static Properties readProperties(String property) throws IOException {
41 String filename = System.getProperty(property);
42 Properties result = new Properties();
4543 if (filename == null) {
46 return;
44 return result;
4745 }
4846 FileInputStream stream = null;
4947 try {
5048 stream = new FileInputStream(filename);
51 extraProperties.load(stream);
49 result.load(stream);
50 return result;
5251 } finally {
53 if (stream != null) {
54 stream.close();
55 }
52 IOUtil.close(stream);
5653 }
5754 }
5855
5956 /**
60 * Fill new commandline array 'newArgs' with properties from
61 * extraProperties and the current commandline array 'args.
57 * Creates a new arguments array first using the given properties then the original arguments.
58 *
59 * @param properties additional properties to add
60 * @param args original commandline arguments
61 * @return new arguments to use
6262 */
63 public static void updateCommandLine(String[] args) throws IOException {
63 public static String[] updateCommandLine(Properties properties, String[] args) throws IOException {
6464 int argsSize = args.length;
65 int extraSize = extraProperties.size();
65 int extraSize = properties.size();
6666
67 newArgs = new String[argsSize + extraSize];
67 String[] newArgs = new String[argsSize + extraSize];
6868
6969 int i = 0;
70 for (Enumeration e = extraProperties.propertyNames(); e.hasMoreElements(); ) {
70 for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
7171 String key = (String) e.nextElement();
72 String value = extraProperties.getProperty(key);
72 String value = properties.getProperty(key);
7373 newArgs[i] = "-D" + key + "=" + value;
7474 i++;
7575 }
7676
7777 System.arraycopy(args, 0, newArgs, extraSize, argsSize);
78 return newArgs;
7879 }
7980
8081 /**
8182 * Wraps maven's main function
8283 */
83 public static int main(String[] args, ClassWorld classWorld) throws IOException {
84 updateProperties("properties.file.manual");
84 public static int main(String[] args) throws IOException {
85 Properties extraArguments = readProperties(EXTRA_PROPERTIES_PROPERTY);
86 String[] newArgs = updateCommandLine(extraArguments, args);
8587
86 updateCommandLine(args);
87
88 return CompatibleMain.main(newArgs, classWorld);
88 MavenCli.main(newArgs);
89 return 0;
8990 }
9091 }
55 <parent>
66 <artifactId>maven-debian</artifactId>
77 <groupId>org.debian.maven</groupId>
8 <version>1.7</version>
8 <version>2.0</version>
99 </parent>
1010
1111 <artifactId>maven-packager-utils</artifactId>
1919 </dependency>
2020 <dependency>
2121 <groupId>org.apache.maven</groupId>
22 <artifactId>maven-artifact</artifactId>
23 </dependency>
24 <dependency>
25 <groupId>org.apache.maven</groupId>
26 <artifactId>maven-project</artifactId>
22 <artifactId>maven-core</artifactId>
2723 </dependency>
2824 <dependency>
2925 <groupId>org.apache.velocity</groupId>
3632 <dependency>
3733 <groupId>junit</groupId>
3834 <artifactId>junit</artifactId>
39 <scope>test</scope>
4035 </dependency>
4136 <dependency>
42 <groupId>commons-io</groupId>
43 <artifactId>commons-io</artifactId>
44 <scope>test</scope>
37 <groupId>org.apache.maven.plugin-tools</groupId>
38 <artifactId>maven-plugin-annotations</artifactId>
4539 </dependency>
4640 </dependencies>
4741 </project>
1515
1616 package org.debian.maven.packager;
1717
18 import org.apache.maven.plugin.AbstractMojo;
19 import org.apache.maven.plugin.MojoExecutionException;
20
2118 import java.io.File;
2219 import java.util.ArrayList;
2320 import java.util.List;
21
22 import org.apache.maven.plugin.AbstractMojo;
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugins.annotations.LifecyclePhase;
25 import org.apache.maven.plugins.annotations.Mojo;
26 import org.apache.maven.plugins.annotations.Parameter;
27 import org.apache.maven.plugins.annotations.ResolutionScope;
2428 import org.apache.maven.project.MavenProject;
2529 import org.debian.maven.packager.util.PackageScanner;
2630 import org.debian.maven.repo.DependencyRuleSetFiles.RulesType;
2933 * Analyze the Maven dependencies and extract the list of dependent packages,
3034 * reusable as subvars in the Debian control file and the list of POM files
3135 * to use and the rules if they did not exist already.
32 *
33 * @goal dependencies
34 * @aggregator
35 * @requiresDependencyResolution
36 * @phase process-sources
3736 *
3837 * @author Ludovic Claude
3938 */
39 @Mojo(name = "dependencies", aggregator = true, requiresDependencyResolution = ResolutionScope.RUNTIME, defaultPhase = LifecyclePhase.PROCESS_SOURCES)
4040 public class DependenciesMojo extends AbstractMojo {
4141
4242 /**
4343 * The Maven Project Object
44 *
45 * @parameter expression="${project}"
46 * @readonly
47 * @required
4844 */
45 @Parameter(property = "project", readonly = true, required = true)
4946 protected MavenProject project;
5047
5148 /**
5249 * A list of every project in this reactor; provided by Maven
53 *
54 * @parameter expression="${project.collectedProjects}"
5550 */
51 @Parameter(property = "project.collectedProjects")
5652 protected List<MavenProject> collectedProjects;
5753
5854 /**
5955 * Location of the file.
60 *
61 * @parameter expression="${debian.directory}"
62 * default-value="debian"
6356 */
57 @Parameter(property = "debian.directory", defaultValue = "debian")
6458 protected File outputDirectory;
6559
6660 /**
6761 * Name of the package (e.g. 'commons-lang')
68 *
69 * @parameter expression="${package}"
70 * @required
7162 */
63 @Parameter(property = "package", required = true)
7264 protected String packageName;
7365
7466 /**
7567 * Type of the package (e.g. 'maven' or 'ant')
76 *
77 * @parameter expression="${packageType}" default-value="maven"
7868 */
69 @Parameter(property = "packageType", defaultValue = "maven")
7970 protected String packageType;
8071
8172 /**
8273 * Should we also resolve Javadoc dependencies
83 *
84 * @parameter expression="${resolveJavadoc}" default-value="false"
8574 */
75 @Parameter(property = "resolveJavadoc", defaultValue = "false")
8676 protected boolean resolveJavadoc;
8777
8878 /**
8979 * Location for the list of POMs file.
90 *
91 * @required
92 * @parameter expression="debian/${package}.poms"
9380 */
81 @Parameter(defaultValue = "debian/${package}.poms", required = true)
9482 protected File listOfPoms;
9583
9684 /**
9785 * Location of the Maven repository
98 *
99 * @parameter expression="${maven.repo.local}" default-value="/usr/share/maven-repo"
10086 */
87 @Parameter(property = "maven.repo.local", defaultValue = "/usr/share/maven-repo")
10188 protected File mavenRepo;
10289
10390 /**
10491 * Interactive execution will ask questions to the user
105 *
106 * @parameter expression="${interactive}" default-value="true"
10792 */
93 @Parameter(property = "interactive", defaultValue = "true")
10894 protected boolean interactive;
10995
11096 /**
11197 * Offline prevents any download from Internet
112 *
113 * @parameter expression="${offline}" default-value="false"
11498 */
99 @Parameter(property = "offline", defaultValue = "false")
115100 protected boolean offline;
116101
117102 /**
118103 * Try to be verbose
119 *
120 * @parameter expression="${verbose}" default-value="false"
121104 */
105 @Parameter(property = "verbose", defaultValue = "false")
122106 protected boolean verbose;
123107
124108 public void execute() throws MojoExecutionException {
3434 import org.apache.maven.model.Developer;
3535 import org.apache.maven.plugin.AbstractMojo;
3636 import org.apache.maven.plugin.MojoExecutionException;
37 import org.apache.maven.plugins.annotations.LifecyclePhase;
38 import org.apache.maven.plugins.annotations.Mojo;
39 import org.apache.maven.plugins.annotations.Parameter;
40 import org.apache.maven.plugins.annotations.ResolutionScope;
3741 import org.apache.maven.project.MavenProject;
3842 import org.apache.velocity.VelocityContext;
3943 import org.apache.velocity.app.Velocity;
4751 /**
4852 * Generate the Debian files for packaging the current Maven project.
4953 *
50 * @goal generate
51 * @aggregator
52 * @requiresDependencyResolution
53 * @phase process-sources
54 *
5554 * @author Ludovic Claude
5655 */
56 @Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_SOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME, aggregator = true)
5757 public class GenerateDebianFilesMojo extends AbstractMojo {
5858
5959 /**
6060 * The Maven Project Object
61 *
62 * @parameter expression="${project}"
63 * @readonly
64 * @required
65 */
61 */
62 @Parameter(property = "project", required = true, readonly = true)
6663 protected MavenProject project;
6764
6865 /**
6966 * A list of every project in this reactor; provided by Maven
70 *
71 * @parameter expression="${project.collectedProjects}"
72 */
67 */
68 @Parameter(property = "project.collectedProjects")
7369 protected List<MavenProject> collectedProjects;
7470
75 /**
76 * @parameter expression="${localRepository}"
77 * @required
78 * @readonly
79 */
71 @Parameter(property = "localRepository", required = true, readonly = true)
8072 protected ArtifactRepository localRepository;
8173
8274 /**
8375 * Location of the file.
84 *
85 * @parameter expression="${debian.directory}"
86 * default-value="debian"
87 */
76 */
77 @Parameter(defaultValue = "debian", property = "debian.directory")
8878 protected File outputDirectory;
8979
9080 /**
9181 * Name of the packager (e.g. 'Ludovic Claude')
92 *
93 * @parameter expression="${packager}"
94 * @required
95 */
82 */
83 @Parameter(required = true, property = "packager")
9684 protected String packager;
9785
9886 /**
9987 * Email of the packager (e.g. 'ludovic.claude@laposte.net')
100 *
101 * @parameter expression="${email}"
102 * @required
103 */
88 */
89 @Parameter(required = true, property = "email")
10490 protected String email;
10591
10692 /**
10793 * License used by the packager (e.g. 'GPL-3' or 'Apache-2.0')
10894 * See http://dep.debian.net/deps/dep5/ for the list of licenses.
109 *
110 * @parameter expression="${packagerLicense}" default-value="GPL-3"
111 * @required
112 */
95 */
96 @Parameter(required = true, property = "packagerLicense", defaultValue = "GPL-3")
11397 protected String packagerLicense;
11498
11599 /**
116100 * Name of the source package (e.g. 'commons-lang')
117 *
118 * @parameter expression="${package}"
119 * @required
120 */
101 */
102 @Parameter(required = true, property = "package")
121103 protected String packageName;
122104
123105 /**
124106 * Name of the binary package (e.g. 'libcommons-lang-java')
125 *
126 * @parameter expression="${bin.package}"
127 * @required
128 */
107 */
108 @Parameter(required = true, property = "bin.package")
129109 protected String binPackageName;
130110
131111 /**
132112 * Type of the package (e.g. 'maven' or 'ant')
133 *
134 * @parameter expression="${packageType}" default-value="maven"
135 */
113 */
114 @Parameter(property = "packageType", defaultValue = "maven")
136115 protected String packageType;
137116
138117 /**
139118 * URL for downloading the source code, in the form scm:[svn|cvs]:http://xxx/
140119 * for downloads using a source code repository,
141120 * or http://xxx.[tar|zip|gz|tgz] for downloads using source tarballs.
142 *
143 * @parameter expression="${downloadUrl}"
144 */
121 */
122 @Parameter(property = "downloadUrl")
145123 protected String downloadUrl;
146124
147125 /**
148126 * If true, include running the tests during the build.
149 *
150 * @parameter expression="${runTests}" default-value="false"
151 */
127 */
128 @Parameter(property = "runTests", defaultValue = "false")
152129 protected boolean runTests;
153130
154131 /**
155132 * If true, generate the Javadoc packaged in a separate package.
156 * @parameter expression="${generateJavadoc}" default-value="false"
157 */
133 */
134 @Parameter(property = "generateJavadoc", defaultValue = "false")
158135 protected boolean generateJavadoc;
159136
160137 /**
1818 import java.io.BufferedReader;
1919 import java.io.IOException;
2020 import java.io.InputStreamReader;
21 import java.io.PrintStream;
2221 import java.io.PrintWriter;
2322
2423 /**
2828 import java.util.List;
2929 import java.util.logging.Level;
3030 import java.util.logging.Logger;
31
3132 import junit.framework.TestCase;
32 import org.apache.commons.io.FileUtils;
33 import org.apache.commons.io.IOUtils;
33
34 import org.codehaus.plexus.util.FileUtils;
35 import org.codehaus.plexus.util.IOUtil;
3436 import org.debian.maven.packager.util.PackageScanner;
3537 import org.debian.maven.repo.DependencyRule;
3638
342344 protected void useFile(String resource, File file) throws IOException {
343345 final FileWriter out = new FileWriter(file);
344346 final Reader in = read(resource);
345 IOUtils.copy(in,out);
347 IOUtil.copy(in,out);
346348 in.close();
347349 out.close();
348350 }
1515
1616 package org.debian.maven.packager.util;
1717
18 import org.junit.Test;
18 import static org.junit.Assert.assertEquals;
1919
2020 import java.util.ArrayList;
2121 import java.util.List;
2222
23 import static junit.framework.Assert.assertEquals;
23 import org.junit.Test;
2424
2525 public class GetPackageContainingPatternResultTest {
2626
1515
1616 package org.debian.maven.packager.util;
1717
18 import org.junit.Test;
18 import static org.junit.Assert.assertEquals;
1919
2020 import java.util.ArrayList;
2121 import java.util.List;
2222
23 import static junit.framework.Assert.assertEquals;
23 import org.junit.Test;
2424
2525 public class GetPackageResultTest {
2626
1515
1616 package org.debian.maven.packager.util;
1717
18 import org.junit.Test;
18 import static org.junit.Assert.assertEquals;
1919
2020 import java.util.ArrayList;
2121 import java.util.List;
2222
23 import static junit.framework.Assert.assertEquals;
23 import org.junit.Test;
2424
2525 public class GetPackageVersionResultTest {
2626
33
44 <groupId>org.debian.maven</groupId>
55 <artifactId>maven-debian</artifactId>
6 <version>1.7</version>
6 <version>2.0</version>
77 <packaging>pom</packaging>
88 <description>Helper tools for using Maven to build Debian packages</description>
9
10 <properties>
11 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12 <maven-plugin-tools.version>3.2</maven-plugin-tools.version>
13 </properties>
914
1015 <modules>
1116 <module>maven-debian-helper</module>
1217 <module>debian-maven-plugin</module>
13 <module>maven-build-nodocs</module>
1418 <module>maven-packager-utils</module>
1519 </modules>
16
17 <dependencies>
18 <dependency>
19 <groupId>org.apache.maven</groupId>
20 <artifactId>maven-core</artifactId>
21 <version>2.2.1</version>
22 </dependency>
23 <dependency>
24 <groupId>org.apache.maven</groupId>
25 <artifactId>maven-compat</artifactId>
26 <version>2.2.1</version>
27 </dependency>
28 <dependency>
29 <groupId>org.codehaus.plexus</groupId>
30 <artifactId>plexus-utils</artifactId>
31 <version>1.5.8</version>
32 </dependency>
33 </dependencies>
3420
3521 <dependencyManagement>
3622 <dependencies>
3723 <dependency>
3824 <groupId>org.debian.maven</groupId>
3925 <artifactId>maven-repo-helper</artifactId>
40 <version>1.8.9</version>
26 <version>[1.8,2.0)</version>
4127 </dependency>
4228 <dependency>
4329 <groupId>org.apache.maven</groupId>
4430 <artifactId>maven-plugin-api</artifactId>
45 <version>2.2.1</version>
31 <version>3.0.5</version>
4632 </dependency>
4733 <dependency>
4834 <groupId>org.apache.maven</groupId>
49 <artifactId>maven-artifact</artifactId>
50 <version>2.2.1</version>
51 </dependency>
52 <dependency>
53 <groupId>classworlds</groupId>
54 <artifactId>classworlds</artifactId>
55 <version>1.1</version>
35 <artifactId>maven-core</artifactId>
36 <version>3.0.5</version>
5637 </dependency>
5738 <dependency>
5839 <groupId>org.apache.maven</groupId>
59 <artifactId>maven-project</artifactId>
60 <version>2.2.1</version>
40 <artifactId>maven-embedder</artifactId>
41 <version>3.0.5</version>
42 </dependency>
43 <dependency>
44 <groupId>org.codehaus.plexus</groupId>
45 <artifactId>plexus-classworlds</artifactId>
46 <version>2.5.1</version>
6147 </dependency>
6248 <dependency>
6349 <groupId>org.apache.velocity</groupId>
7157 <scope>test</scope>
7258 </dependency>
7359 <dependency>
74 <groupId>commons-io</groupId>
75 <artifactId>commons-io</artifactId>
76 <version>2.4</version>
77 <scope>test</scope>
60 <groupId>org.apache.maven.plugin-tools</groupId>
61 <artifactId>maven-plugin-annotations</artifactId>
62 <version>${maven-plugin-tools.version}</version>
63 <scope>provided</scope>
7864 </dependency>
7965 </dependencies>
8066 </dependencyManagement>
8470 <plugins>
8571 <plugin>
8672 <artifactId>maven-compiler-plugin</artifactId>
87 <version>2.1</version>
73 <version>2.5.1</version>
8874 <configuration>
8975 <source>1.6</source>
9076 <target>1.6</target>
9177 </configuration>
9278 </plugin>
79 <plugin>
80 <artifactId>maven-jar-plugin</artifactId>
81 <version>2.4</version>
82 </plugin>
83 <plugin>
84 <artifactId>maven-plugin-plugin</artifactId>
85 <version>${maven-plugin-tools.version}</version>
86 <executions>
87 <execution>
88 <id>default-descriptor</id>
89 <phase>process-classes</phase>
90 <goals>
91 <goal>descriptor</goal>
92 </goals>
93 </execution>
94 </executions>
95 </plugin>
9396 </plugins>
9497 </pluginManagement>
9598 </build>
3232
3333 # Maven home directory. Doesn't need to be changed except when using
3434 # nonstandard Maven installations.
35 MAVEN_HOME = /usr/share/maven2
35 MAVEN_HOME = /usr/share/maven
3636
3737 MAVEN_DEBIAN_VERSION = $(shell ls /usr/share/maven-repo/org/debian/maven/maven-packager-utils/ | sed 's|/||')
38 MAVEN_CLASSCONF = /etc/maven2/m2-debian.conf
38 MAVEN_CLASSCONF = /etc/maven/m2-debian.conf
39 MAVEN_SETTINGS = /etc/maven/settings-debian.xml
3940
4041 # The home directory of the Java Runtime Environment (JRE) or Java Development
4142 # Kit (JDK). You can either directly set JAVA_HOME in debian/rules or set
5354 # end of the class path if it exists in the JDK's lib directory.
5455 # You can override the complete class path using DEB_CLASSPATH.
5556 DEB_JARS_BASE = /usr/share/java
56 DEB_CLASSPATH = $(MAVEN_HOME)/boot/classworlds.jar:$(shell for jar in $(DEB_JARS); do \
57 DEB_CLASSPATH = $(MAVEN_HOME)/boot/plexus-classworlds-2.x.jar:$(shell for jar in $(DEB_JARS); do \
5758 if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; \
5859 if [ -f "$$jar".jar ]; then echo -n "$${jar}.jar:"; fi; \
5960 if [ -f $(DEB_JARS_BASE)/"$$jar" ]; then echo -n "$(DEB_JARS_BASE)/$${jar}:"; fi; \
9394 DEB_MAVEN_INVOKE = cd $(DEB_BUILDDIR) && $(JAVACMD) -noverify -cp $(DEB_CLASSPATH) \
9495 $(JAVA_OPTS) -Dclassworlds.conf=$(MAVEN_CLASSCONF) \
9596 org.codehaus.classworlds.Launcher \
96 -s/etc/maven2/settings-debian.xml \
97 -s$(MAVEN_SETTINGS) \
9798 -Dmaven.repo.local=$(DEB_MAVEN_REPO) \
9899 $(if $(DEB_MAVEN_ARGS_$(cdbs_curpkg)),$(DEB_MAVEN_ARGS_$(cdbs_curpkg)),$(DEB_MAVEN_ARGS))
99100
3131 include $(_cdbs_class_path)/maven-vars.mk$(_cdbs_makefile_suffix)
3232
3333 DEB_MAVEN_REPO := $(CURDIR)/debian/maven-repo
34 DEB_MAVEN_SCRIPT_DIR := /usr/share/maven-debian-helper/
3435
3536 JAVA_OPTS = \
3637 $(shell test -n "$(DEB_MAVEN_PROPERTYFILE)" && echo -Dproperties.file.manual=$(DEB_MAVEN_PROPERTYFILE))
5253 echo "You must specify a valid JAVA_HOME or JAVACMD!"; \
5354 exit 1; \
5455 fi
55 @if ! test -r "$(MAVEN_HOME)/boot/classworlds.jar"; then \
56 @if ! test -r "$(MAVEN_HOME)/boot/plexus-classworlds-2.x.jar"; then \
5657 echo "You must specify a valid MAVEN_HOME directory!"; \
5758 exit 1; \
5859 fi
6566
6667 ifeq (, $(DEB_DOC_PACKAGE))
6768 DEB_PATCHPOMS_ARGS += --build-no-docs
68 debian/stamp-maven-build: override MAVEN_CLASSCONF = /etc/maven2/m2-debian-nodocs.conf
6969 endif
7070
7171 debian/stamp-poms-patched: debian/maven-repo
7979 $(RM) -f debian/stamp-poms-patched
8080
8181 debian/maven-repo:
82 /usr/share/maven-debian-helper/copy-repo.sh $(CURDIR)/debian
82 $(DEB_MAVEN_SCRIPT_DIR)/copy-repo.sh $(CURDIR)/debian
8383
8484 post-patches:: patch-poms
8585
1717
1818 SRC_REPO="/usr/share/maven-repo"
1919 DEST_REPO="$1/maven-repo"
20 PLUGIN_GROUPS="org.apache.maven.plugins org.codehaus.mojo"
21 METADATA_NAME="maven-metadata-local.xml"
2022
2123 find_src_poms() {
2224 find -L $SRC_REPO -name '*.pom' -printf '%P\n'
2325 }
2426
27 find_group_artifact_ids() {
28 find -L $SRC_REPO/$1/* -type d -prune -printf '%f\n'
29 }
30
31 read_maven_plugin_xpath() {
32 unzip -q -c "$1" META-INF/maven/plugin.xml 2>/dev/null | xmllint --xpath "$2" - 2>/dev/null
33 }
34
2535 list_fakes()
2636 {
27 CONFFILES="/etc/maven2/fake-poms.conf"
37 CONFFILES="/etc/maven/fake-poms.conf"
2838 if [ -r debian/fake-poms.conf ]
2939 then
3040 CONFFILES="$CONFFILES debian/fake-poms.conf"
3141 fi
3242 sed -e's,#.*,,' $CONFFILES
33 }
34
35 find_all_meta() {
36 find $DEST_REPO -name 'maven-metadata-tmp.xml'
37 }
38
39 header() {
40 echo '<?xml version="1.0" encoding="UTF-8"?>'
41 echo '<metadata>'
42 echo ' <versioning>'
43 echo ' <versions>'
44 }
45
46 footer() {
47 echo ' </versions>'
48 echo ' </versioning>'
49 echo '</metadata>'
50 }
51
52 echo_meta() {
53 header
54 cat $META
55 footer
5643 }
5744
5845 if [ -z "$1" ]; then
9885 .EOF
9986 done
10087
101 find_all_meta | while read META; do
102 DIR=$(dirname $META)
103 echo_meta > $DIR/maven-metadata-local.xml
104 rm -f $META
88 # construct plugin metadata
89 for groupId in $PLUGIN_GROUPS; do
90 GROUP=$(echo $groupId | tr . \/)
91 if test ! -d "$DEST_REPO/$GROUP"; then
92 continue
93 fi
94
95 # plugin group metadata
96 cat > $DEST_REPO/$GROUP/$METADATA_NAME <<EOF
97 <metadata>
98 <plugins>
99 EOF
100 find_group_artifact_ids $GROUP | while read artifactId; do
101 for jar in $SRC_REPO/$GROUP/$artifactId/*/*.jar; do
102 prefix=$(read_maven_plugin_xpath "$jar" '/plugin/goalPrefix/text()')
103 if test -z "$prefix"; then
104 continue
105 fi
106 name=$(read_maven_plugin_xpath "$jar" '/plugin/name/text()')
107 cat >> $DEST_REPO/$GROUP/$METADATA_NAME <<EOF
108 <plugin>
109 <name>$name</name>
110 <prefix>$prefix</prefix>
111 <artifactId>$artifactId</artifactId>
112 </plugin>
113 EOF
114 break
115 done
116 done
117 cat >> $DEST_REPO/$GROUP/$METADATA_NAME <<EOF
118 </plugins>
119 </metadata>
120 EOF
121
122 # plugin version metadata
123 find_group_artifact_ids $GROUP | while read artifactId; do
124 cat > $DEST_REPO/$GROUP/$artifactId/$METADATA_NAME <<EOF
125 <metadata>
126 <groupId>$groupId</groupId>
127 <artifactId>$artifactId</artifactId>
128 <versioning>
129 <versions>
130 EOF
131 find $SRC_REPO/$GROUP/$artifactId/*/*.jar | while read jar; do
132 version=$(basename $(dirname $jar))
133 cat >> $DEST_REPO/$GROUP/$artifactId/$METADATA_NAME <<EOF
134 <version>$version</version>
135 EOF
136 done
137 cat >> $DEST_REPO/$GROUP/$artifactId/$METADATA_NAME <<EOF
138 </versions>
139 </versioning>
140 </metadata>
141 EOF
142 done
105143 done
106
2525 my @packages = @{$dh{DOPACKAGES}};
2626 $this->{package} = shift @packages;
2727 $this->{doc_package} = (grep /-doc$/, @packages)[0];
28 my $classconf = '/etc/maven2/m2-debian.conf';
29 if (!$this->{doc_package}) {
30 $classconf = '/etc/maven2/m2-debian-nodocs.conf';
31 }
28 my $classconf = '/etc/maven/m2-debian.conf';
3229
33 my @classpath = ('/usr/share/maven2/boot/classworlds.jar');
30 my @classpath = ('/usr/share/maven/boot/classworlds-2.x.jar');
3431 if (-e "$java_home/lib/tools.jar") {
3532 push(@classpath, "$java_home/lib/tools.jar");
3633 }
4441 @{$this->{maven_cmd}} = ($java_home . '/bin/java',
4542 @jvmopts,
4643 "org.codehaus.classworlds.Launcher",
47 "-s/etc/maven2/settings-debian.xml",
44 "-s/etc/maven/settings-debian.xml",
4845 "-Ddebian.dir=$this->{cwd}/debian",
4946 "-Dmaven.repo.local=$this->{cwd}/debian/maven-repo");
5047 return $this;
5350 sub configure {
5451 my $this=shift;
5552 my @patch_args;
56 if (! $this->{doc_package}) {
57 push(@patch_args, "--build-no-docs");
58 }
5953
6054 doit("/usr/share/maven-debian-helper/copy-repo.sh", "$this->{cwd}/debian");
6155 $this->doit_in_sourcedir("mh_patchpoms", "-p$this->{package}",