Codebase list maven-debian-helper / 62586bf
* mh_make handles better multi projects * mh_make generates projects following the Debian 3.8.3 policy * Documentation improvements * maven.mk: unpatch the poms in cleanbuilddir, to have a good clean sequence when maven.mk is used with a patch system - clean target -> mvn clean -> rm tmp files -> unpatch pom files -> unpatch files with patch system * Read rules from the Maven repository to force the version of Maven plugins to be the same as in the repository * maven.mk removes some elements from the POM files when their use is against the Debian policy (<repositories> as they imply downloading artifacts from the Internet, <distributionManagement> as it implies publishing on the net or in a location not controlled by Debian) or when they are not needed and risk pulling out unwanted dependencies (<reports> which is not used if a documentation package is not generated) * maven.mk adds a patch to Maven to disable using the maven-site-plugin when no documentation package is generated. This helps to reduce the amount of build dependencies Ludovic Claude 14 years ago
20 changed file(s) with 627 addition(s) and 77 deletion(s). Raw diff Collapse all Expand all
2222 echo -e "\t during the build"
2323 echo -e "\t-a --ant: use Ant for the packaging instead of Maven"
2424 echo -e "\t-v --verbose: show more information while running"
25 echo -e ""
26 echo -e "To have mh_make working properly, you need first to install on your system"
27 echo -e "as many dependencies for your project as possible. Those dependencies should"
28 echo -e "also contain the required Maven metadata (POM files and jars in the"
29 echo -e "/usr/share/maven-repo repository)"
30 echo -e ""
31 echo -e "Environment variables:"
32 echo -e "\tDEBFULLNAME - your full name, e.g. John Doe"
33 echo -e "\tDEBEMAIL - your packager email address"
34 echo -e "\tDEBLICENSE - the license for the files under the debian/ directory"
35 echo -e "\t must be one of GPL2, GPL3, LGPL2.1, Apache-2.0, BSD or any license"
36 echo -e "\t short name defined in http://dep.debian.net/deps/dep5/"
2537 exit 1
2638 }
2739
5769 FROM_SVN=$(getarg s from-svn)
5870
5971 if [ -z "$PACKAGE" ]; then
60 PACKAGE="$(basename $(pwd))"
72 PACKAGE="$(basename $(pwd) | sed 's/-[0-9\.].*//')"
6173 if [ -n "$FROM_SVN" ]; then
62 PACKAGE=$(basename $FROM_SVN | sed 's/-[0-9].*//' )
74 PACKAGE=$(basename $FROM_SVN | sed 's/-[0-9\.].*//' )
6375 fi
6476 echo "Enter the name of the new Debian source package. If empty, it will defaults to $PACKAGE"
6577 read -p ">" USER_PACKAGE
7890 fi
7991
8092 if [ -z "$RUN_TESTS" ]; then
81 RUN_TESTS="false"
8293 echo "Enter y (yes) or n (no) to run tests while building the package. Defaults to no"
8394 read -p ">" RUN
8495 if [ "$RUN" == "y" ]; then
8798 fi
8899
89100 if [ -z "$GEN_JAVADOC" ]; then
90 GEN_JAVADOC="false"
91101 echo "Enter y (yes) or n (no) to generate the Javadoc while building the package. Defaults to no"
92102 read -p ">" GEN
93103 if [ "$GEN" == "y" ]; then
100110 cd $PACKAGE
101111 fi
102112
103 if [ ! -e debian/${BIN_PACKAGE}.substvars ]; then
104 java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar org.debian.maven.packager.DependenciesSolver --package="$BIN_PACKAGE" ${ANT:--ant} --maven-repo=/usr/share/maven-repo
105 fi
106
107113 if [ -e pom.xml.save ]; then
108114 mh_unpatchpoms -p$BIN_PACKAGE
109115 fi
110
111 mh_patchpoms -p$BIN_PACKAGE --keep-pom-version
116
117 java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar:/usr/share/maven2/lib/maven-debian-uber.jar org.debian.maven.packager.DependenciesSolver --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} --maven-repo=/usr/share/maven-repo
118
119 mh_patchpoms -p$BIN_PACKAGE -rdebian/maven.rules -idebian/maven.ignoreRules --keep-pom-version
112120
113121 mvn org.debian.maven:maven-packager-utils:$MH_VERSION:generate -Demail="$DEBEMAIL" -Dpackager="$DEBFULLNAME" -DpackagerLicense="$DEBLICENSE" -Dpackage="$PACKAGE" -Dbin.package="$BIN_PACKAGE" -DrunTests="$RUN_TESTS" -DgenerateJavadoc="$GEN_JAVADOC" -Dmaven.repo.local=/usr/share/maven-repo ${ANT:+-DpackageType=ant} ${FROM_SVN:+-DdownloadUrl=scm:svn:$FROM_SVN} --offline
114122
116124
117125 if [ ! -f debian/changelog ]; then
118126 mkdir -p debian/tmp
119 mh_cleanpom -p$PACKAGE pom.xml debian/tmp/pom.xml debian/tmp/pom.properties
127 mh_cleanpom -p$PACKAGE pom.xml.save debian/tmp/pom.xml debian/tmp/pom.properties
120128 source debian/tmp/pom.properties
121129 rm -R debian/tmp
122130 version=$(echo $version | sed -re's/-(alpha|beta)-?/~\1/')
1717 echo -e "\t-V --version: show the version"
1818 echo -e "\t-p<package> --package=<package>: name of the package"
1919 echo -e "\t-a --ant: use Ant for the packaging instead of Maven"
20 echo -e "\t-n --non-interactive: non interactive mode, don't ask questions"
2021 echo -e "\t-v --verbose: show more information while running"
2122 echo -e ""
2223 echo -e "Description:"
3334 exit 1
3435 }
3536
36 ARGS="p package a ant v verbose" parseargs "$@"
37 ARGS="p package a ant v verbose n non-interactive" parseargs "$@"
3738
3839 PACKAGE=$(getarg p package)
3940 ANT=$(getarg a ant)
41 NON_INTERACTIVE=$(getarg n non-interactive)
4042
4143 if [ -z "$PACKAGE" ]; then
4244 if [ "$ARGC" -gt "0" ]; then
5961 fi
6062 fi
6163
62 mvn org.debian.maven:maven-packager-utils:$MH_VERSION:dependencies -Dpackage="$PACKAGE" ${ANT:+-DpackageType=ant} -Dmaven.repo.local=/usr/share/maven-repo --offline
64 mvn org.debian.maven:maven-packager-utils:$MH_VERSION:dependencies -Dpackage="$PACKAGE" ${ANT:+-DpackageType=ant} -Dmaven.repo.local=/usr/share/maven-repo ${NON_INTERACTIVE:+-DnonInteractive=true} --offline
6365
6466 perl -p -i -e 's/maven\./maven:/' debian/${PACKAGE}.substvars
4343 <cleanmodule dir=""/>
4444 <cleanmodule dir="maven-debian-helper"/>
4545 <cleanmodule dir="maven-debian-plugin"/>
46 <cleanmodule dir="maven-build-nodocs"/>
4647 <cleanmodule dir="maven-packager-utils"/>
4748 </target>
4849
4950 <target name="package">
5051 <packagemodule dir=""/>
5152 <packagemodule dir="maven-debian-helper"/>
53 <packagemodule dir="maven-build-nodocs"/>
5254 <package-plugin-module dir="maven-debian-plugin"/>
5355 <package-plugin-module dir="maven-packager-utils"/>
5456 </target>
0 maven-debian-helper (0.8) UNRELEASED; urgency=low
0 maven-debian-helper (0.8) unstable; urgency=low
11
22 * mh_make falls back on EMAIL when DEBEMAIL is not set
3 * mh_make handles better multi projects
4 * mh_make generates projects following the Debian 3.8.3 policy
5 * Documentation improvements
6 * maven.mk: unpatch the poms in cleanbuilddir, to have a good
7 clean sequence when maven.mk is used with a patch system -
8 clean target -> mvn clean -> rm tmp files -> unpatch pom files
9 -> unpatch files with patch system
10 * Read rules from the Maven repository to force the version of
11 Maven plugins to be the same as in the repository
12 * maven.mk removes some elements from the POM files when their
13 use is against the Debian policy (<repositories> as they
14 imply downloading artifacts from the Internet,
15 <distributionManagement> as it implies publishing on the net
16 or in a location not controlled by Debian) or when they are
17 not needed and risk pulling out unwanted dependencies
18 (<reports> which is not used if a documentation package is
19 not generated)
20 * maven.mk adds a patch to Maven to disable using the
21 maven-site-plugin when no documentation package is generated.
22 This helps to reduce the amount of build dependencies
323
424 -- Ludovic Claude <ludovic.claude@laposte.net> Mon, 04 Jan 2010 23:13:29 +0100
525
00 pom.xml --no-parent
11 maven-debian-helper/pom.xml
22 maven-debian-plugin/pom.xml
3 maven-build-nodocs/pom.xml
34 maven-packager-utils/pom.xml
+0
-9
debian/maven-settings.xml less more
0 <!--
1 This is a minimal settings.xml that switches maven to offline mode
2 and uses the Debian repo as the local repo.
3 -->
4
5 <settings>
6 <localRepository>/usr/share/maven-repo</localRepository>
7 <offline>true</offline>
8 </settings>
4444 mh_installpoms -p$(PACKAGE)
4545 mh_installjar -p$(PACKAGE) -l maven-debian-helper/pom.xml maven-debian-helper/target/maven-debian-helper-$(VERSION).jar
4646 mh_installjar -p$(PACKAGE) -l maven-debian-plugin/pom.xml maven-debian-plugin/target/maven-debian-plugin-$(VERSION).jar
47 mh_installjar -p$(PACKAGE) -l maven-build-nodocs/pom.xml maven-build-nodocs/target/maven-build-nodocs-$(VERSION).jar
4748 mh_installjar -p$(PACKAGE) -l maven-packager-utils/pom.xml maven-packager-utils/target/maven-packager-utils-$(VERSION).jar
4849 pod2man -c 'Maven for Debian GNU/Linux' \
4950 -r maven-debian-helper-$(DEB_UPSTREAM_VERSION) \
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
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>0.6</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 <!--
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>
9595 */
9696 private String mavenRules;
9797
98 /**
99 * root directory of the Maven repository
100 *
101 * @parameter expression="${basedir}"
102 * @readonly
103 */
104 private File repoDir;
105
98106 // ----------------------------------------------------------------------
99107 // Public methods
100108 // ----------------------------------------------------------------------
431439 {
432440 debianPackage = System.getProperty("debian.package");
433441 }
442 if (repoDir == null)
443 {
444 repoDir = new File(System.getProperty("maven.repo.local"));
445 }
434446 }
435447
436448 /**
6969 */
7070 protected String packageType;
7171 /**
72 * Location for the list of POMs file.
73 * @required
74 * @parameter expression="debian/${package}.poms"
75 */
76 protected File listOfPoms;
77 /**
7278 * Location of the Maven repository
7379 *
74 * @parameter default-value="/usr/share/maven-repo"
80 * @parameter expression="${maven.repo.local}" default-value="/usr/share/maven-repo"
7581 */
7682 protected File mavenRepo;
83 /**
84 * Type of the package (e.g. 'maven' or 'ant')
85 * @parameter expression="${nonInteractive}" default-value="false"
86 */
87 protected boolean nonInteractive;
7788
7889 public void execute()
7990 throws MojoExecutionException {
100111 solver.setOutputDirectory(outputDirectory);
101112 solver.setPackageName(packageName);
102113 solver.setPackageType(packageType);
114 solver.setNonInteractive(nonInteractive);
115 if (listOfPoms != null) {
116 solver.setListOfPoms(listOfPoms);
117 }
103118
104119 solver.solveDependencies();
105120
2929 import java.io.PrintWriter;
3030 import java.util.ArrayList;
3131 import java.util.Collection;
32 import java.util.HashMap;
33 import java.util.HashSet;
3234 import java.util.Iterator;
3335 import java.util.List;
3436 import java.util.Properties;
5254 */
5355 public class DependenciesSolver {
5456
57 // Plugins not useful for the build or whose use is against the
58 // Debian policy
59 private static final String[][] PLUGINS_TO_IGNORE = {
60 {"org.apache.maven.plugins", "maven-ant-plugin"},
61 {"org.apache.maven.plugins", "maven-archetype-plugin"},
62 {"org.apache.maven.plugins", "maven-deploy-plugin"},
63 {"org.apache.maven.plugins", "maven-release-plugin"},
64 {"org.apache.maven.plugins", "maven-remote-resources-plugin"},
65 {"org.apache.maven.plugins", "maven-repository-plugin"},
66 {"org.apache.maven.plugins", "maven-scm-plugin"},
67 {"org.apache.maven.plugins", "maven-stage-plugin"},
68 {"org.apache.maven.plugins", "maven-eclipse-plugin"},
69 {"org.apache.maven.plugins", "maven-idea-plugin"},
70 {"org.codehaus.mojo", "netbeans-freeform-maven-plugin"},
71 {"org.codehaus.mojo", "nbm-maven-plugin"},
72 {"org.codehaus.mojo", "ideauidesigner-maven-plugin"},
73 {"org.codehaus.mojo", "scmchangelog-maven-plugin"},};
74 private static final String[][] PLUGINS_THAT_CAN_BE_IGNORED = {
75 {"org.apache.maven.plugins", "maven-assembly-plugin"},
76 {"org.codehaus.mojo", "buildnumber-maven-plugin"},
77 {"org.apache.maven.plugins", "maven-verifier-plugin"},
78 {"org.codehaus.mojo", "findbugs-maven-plugin"},
79 {"org.codehaus.mojo", "fitnesse-maven-plugin"},
80 {"org.codehaus.mojo", "selenium-maven-plugin"},
81 {"org.codehaus.mojo", "dbunit-maven-plugin"},
82 {"org.codehaus.mojo", "failsafe-maven-plugin"},
83 {"org.codehaus.mojo", "shitty-maven-plugin"},};
84 private static final String[][] DOC_PLUGINS = {
85 {"org.apache.maven.plugins", "maven-changelog-plugin"},
86 {"org.apache.maven.plugins", "maven-changes-plugin"},
87 {"org.apache.maven.plugins", "maven-checkstyle-plugin"},
88 {"org.apache.maven.plugins", "maven-docck-plugin"},
89 {"org.apache.maven.plugins", "maven-javadoc-plugin"},
90 {"org.apache.maven.plugins", "maven-jxr-plugin"},
91 {"org.apache.maven.plugins", "maven-pmd-plugin"},
92 {"org.apache.maven.plugins", "maven-project-info-reports-plugin"},
93 {"org.apache.maven.plugins", "maven-surefire-report-plugin"},
94 {"org.apache.maven.plugins", "maven-pdf-plugin"},
95 {"org.apache.maven.plugins", "maven-site-plugin"},
96 {"org.codehaus.mojo", "clirr-maven-plugin"},
97 {"org.codehaus.mojo", "cobertura-maven-plugin"},
98 {"org.codehaus.mojo", "taglist-maven-plugin"},
99 {"org.codehaus.mojo", "dita-maven-plugin"},
100 {"org.codehaus.mojo", "docbook-maven-plugin"},
101 {"org.codehaus.mojo", "javancss-maven-plugin"},
102 {"org.codehaus.mojo", "jdepend-maven-plugin"},
103 {"org.codehaus.mojo", "dashboard-maven-plugin"},
104 {"org.codehaus.mojo", "emma-maven-plugin"},
105 {"org.codehaus.mojo", "sonar-maven-plugin"},};
106 private static final String[][] TEST_PLUGINS = {
107 {"org.apache.maven.plugins", "maven-failsafe-plugin"},
108 {"org.apache.maven.plugins", "maven-surefire-plugin"},
109 {"org.apache.maven.plugins", "maven-verifier-plugin"},
110 {"org.codehaus.mojo", "findbugs-maven-plugin"},
111 {"org.codehaus.mojo", "fitnesse-maven-plugin"},
112 {"org.codehaus.mojo", "selenium-maven-plugin"},
113 {"org.codehaus.mojo", "dbunit-maven-plugin"},
114 {"org.codehaus.mojo", "failsafe-maven-plugin"},
115 {"org.codehaus.mojo", "shitty-maven-plugin"},};
116 private static final String[][] EXTENSIONS_TO_IGNORE = {
117 {"org.apache.maven.wagon", "wagon-ssh"},
118 {"org.apache.maven.wagon", "wagon-ssh-external"},
119 {"org.apache.maven.wagon", "wagon-ftp"},
120 {"org.apache.maven.wagon", "wagon-http"},
121 {"org.apache.maven.wagon", "wagon-http-lightweight"},
122 {"org.apache.maven.wagon", "wagon-scm"},};
123
55124 protected File baseDir;
125 protected File listOfPoms;
56126 protected File outputDirectory;
57127 protected String packageName;
58128 protected String packageType;
59129 protected File mavenRepo = new File("/usr/share/maven-repo");
60130 protected boolean exploreProjects;
61131 protected List projects = new ArrayList();
62
63132 private Repository repository;
64133 private List issues = new ArrayList();
65134 private List pomsConfig = new ArrayList();
135 private List projectPoms = new ArrayList();
136 private List toResolve = new ArrayList();
66137 private Set compileDepends = new TreeSet();
67138 private Set testDepends = new TreeSet();
68139 private Set runtimeDepends = new TreeSet();
69140 private Set optionalDepends = new TreeSet();
70141 private Set rules = new TreeSet();
142 private Set ignoreRules = new TreeSet();
143 private Set cleanIgnoreRules = new TreeSet();
144 private Set ignoredDependencies = new HashSet();
71145 private boolean checkedAptFile;
146 private boolean runTests;
147 private boolean generateJavadoc;
148 private boolean nonInteractive;
149 private boolean askedToFilterModules = false;
150 private boolean filterModules = false;
151
152 public void setRunTests(boolean b) {
153 this.runTests = b;
154 }
155
156 private void setGenerateJavadoc(boolean b) {
157 this.generateJavadoc = b;
158 }
159
160 private boolean containsPlugin(String[][] pluginDefinitions, Dependency plugin) {
161 for (int i = 0; i < pluginDefinitions.length; i++) {
162 if (!plugin.getGroupId().equals(pluginDefinitions[i][0])) {
163 continue;
164 }
165 if (plugin.getArtifactId().equals(pluginDefinitions[i][1])) {
166 return true;
167 }
168 }
169 return false;
170 }
171
172 private boolean isJavadocPlugin(Dependency dependency) {
173 return containsPlugin(DOC_PLUGINS, dependency);
174 }
175
176 private boolean isTestPlugin(Dependency dependency) {
177 return containsPlugin(TEST_PLUGINS, dependency);
178 }
179
180 private boolean isDefaultMavenPlugin(Dependency dependency) {
181 if (repository != null && repository.getSuperPOM() != null) {
182 for (Iterator i = repository.getSuperPOM().getPluginManagement().iterator(); i.hasNext();) {
183 Dependency defaultPlugin = (Dependency) i.next();
184 if (defaultPlugin.equalsIgnoreVersion(dependency)) {
185 return true;
186 }
187 }
188 }
189 return false;
190 }
191
192 private boolean canIgnorePlugin(Dependency dependency) {
193 return containsPlugin(PLUGINS_TO_IGNORE, dependency);
194 }
195
196 private boolean canIgnoreExtension(Dependency dependency) {
197 return containsPlugin(EXTENSIONS_TO_IGNORE, dependency);
198 }
199
200 private boolean canBeIgnoredPlugin(Dependency dependency) {
201 return containsPlugin(PLUGINS_THAT_CAN_BE_IGNORED, dependency);
202 }
203
204 private boolean askIgnoreDependency(Dependency dependency, String message) {
205 if (nonInteractive) {
206 return false;
207 }
208 System.out.println(message);
209 System.out.println(" " + dependency);
210 System.out.print("[y]/n > ");
211 String s = System.console().readLine().trim().toLowerCase();
212 if (s.startsWith("n")) {
213 return false;
214 }
215 return true;
216 }
217
218 public void setNonInteractive(boolean nonInteractive) {
219 this.nonInteractive = nonInteractive;
220 }
221
222 private class ToResolve {
223
224 private final File sourcePom;
225 private final Collection poms;
226 private final boolean buildTime;
227 private final boolean mavenExtension;
228 private final boolean management;
229
230 private ToResolve(File sourcePom, Collection poms, boolean buildTime, boolean mavenExtension, boolean management) {
231 this.sourcePom = sourcePom;
232 this.poms = poms;
233 this.buildTime = buildTime;
234 this.mavenExtension = mavenExtension;
235 this.management = management;
236 }
237
238 public void resolve() {
239 resolveDependencies(sourcePom, poms, buildTime, mavenExtension, management);
240 }
241 }
72242
73243 public File getBaseDir() {
74244 return baseDir;
75245 }
76246
247 public File getListOfPoms() {
248 return listOfPoms;
249 }
250
251 public void setListOfPoms(File listOfPoms) {
252 this.listOfPoms = listOfPoms;
253 }
254
77255 public void saveListOfPoms() {
78 File listPoms = new File(outputDirectory, packageName + ".poms");
79 if (!listPoms.exists()) {
256 if (listOfPoms != null && !listOfPoms.exists()) {
80257 try {
81 PrintWriter out = new PrintWriter(new FileWriter(listPoms));
258 PrintWriter out = new PrintWriter(new FileWriter(listOfPoms));
82259 for (Iterator i = pomsConfig.iterator(); i.hasNext();) {
83260 String config = (String) i.next();
84261 out.println(config);
85262 }
263 out.flush();
86264 out.close();
87265 } catch (Exception ex) {
88266 Logger.getLogger(DependenciesSolver.class.getName()).log(Level.SEVERE, null, ex);
95273 if (!mavenRules.exists()) {
96274 try {
97275 PrintWriter out = new PrintWriter(new FileWriter(mavenRules));
276 out.println("# Maven rules - transform Maven dependencies and plugins");
277 out.println("# Format of this file is:");
278 out.println("# [group] [artifact] [type] [version]");
279 out.println("# where each element can be either");
280 out.println("# - the exact string, for example org.apache for the group, or 3.1");
281 out.println("# for the version. In this case, the element is simply matched");
282 out.println("# and left as it is");
283 out.println("# - * (the star character, alone). In this case, anything will");
284 out.println("# match and be left as it is. For example, using * on the");
285 out.println("# position of the artifact field will match any artifact id");
286 out.println("# - a regular expression of the form s/match/replace/");
287 out.println("# in this case, elements that match are transformed using");
288 out.println("# the regex rule.");
289 out.println("# All elements much match before a rule can be applied");
290 out.println("# Example rule: match jar with groupid= junit, artifactid= junit");
291 out.println("# and version starting with 3., replacing the version with 3.x");
292 out.println("# junit junit jar s/3\\..*/3.x/");
293
98294 for (Iterator i = rules.iterator(); i.hasNext();) {
99295 String rule = (String) i.next();
100296 out.println(rule);
101297 }
298 out.flush();
299 out.close();
300 } catch (IOException ex) {
301 Logger.getLogger(DependenciesSolver.class.getName()).log(Level.SEVERE, null, ex);
302 }
303 }
304 }
305
306 public void saveMavenPublishedRules() {
307 File mavenRules = new File(outputDirectory, "maven.publishedRules");
308 if (!mavenRules.exists()) {
309 try {
310 PrintWriter out = new PrintWriter(new FileWriter(mavenRules));
311 out.println("# Maven published rules - additional rules to publish, to help");
312 out.println("# the packaging work of Debian maintainers using mh_make");
313 out.println("# Format of this file is:");
314 out.println("# [group] [artifact] [type] [version]");
315 out.println("# where each element can be either");
316 out.println("# - the exact string, for example org.apache for the group, or 3.1");
317 out.println("# for the version. In this case, the element is simply matched");
318 out.println("# and left as it is");
319 out.println("# - * (the star character, alone). In this case, anything will");
320 out.println("# match and be left as it is. For example, using * on the");
321 out.println("# position of the artifact field will match any artifact id");
322 out.println("# - a regular expression of the form s/match/replace/");
323 out.println("# in this case, elements that match are transformed using");
324 out.println("# the regex rule.");
325 out.println("# All elements much match before a rule can be applied");
326 out.println("# Example rule: match any dependency whose group is ant,");
327 out.println("# replacing it with org.apache.ant");
328 out.println("# s/ant/org.apache.ant/ * * s/.*/debian/");
329
330 out.flush();
331 out.close();
332 } catch (IOException ex) {
333 Logger.getLogger(DependenciesSolver.class.getName()).log(Level.SEVERE, null, ex);
334 }
335 }
336 }
337
338 public void saveMavenIgnoreRules() {
339 File mavenRules = new File(outputDirectory, "maven.ignoreRules");
340 if (!mavenRules.exists()) {
341 try {
342 PrintWriter out = new PrintWriter(new FileWriter(mavenRules));
343 out.println("# Maven ignore rules - ignore some Maven dependencies and plugins");
344 out.println("# Format of this file is:");
345 out.println("# [group] [artifact] [type] [version]");
346 out.println("# where each element can be either");
347 out.println("# - the exact string, for example org.apache for the group, or 3.1");
348 out.println("# for the version. In this case, the element is simply matched");
349 out.println("# and left as it is");
350 out.println("# - * (the star character, alone). In this case, anything will");
351 out.println("# match and be left as it is. For example, using * on the");
352 out.println("# position of the artifact field will match any artifact id");
353 out.println("# All elements much match before a rule can be applied");
354 out.println("# Example rule: match jar with groupid= junit, artifactid= junit");
355 out.println("# and version starting with 3., this dependency is then removed");
356 out.println("# from the POM");
357 out.println("# junit junit jar s/3\\..*/3.x/");
358
359 for (Iterator i = ignoreRules.iterator(); i.hasNext();) {
360 String rule = (String) i.next();
361 out.println(rule);
362 }
363
364 out.flush();
365 out.close();
366 } catch (IOException ex) {
367 Logger.getLogger(DependenciesSolver.class.getName()).log(Level.SEVERE, null, ex);
368 }
369 }
370 }
371
372 public void saveMavenCleanIgnoreRules() {
373 File mavenRules = new File(outputDirectory, "maven.cleanIgnoreRules");
374 if (!mavenRules.exists()) {
375 try {
376 PrintWriter out = new PrintWriter(new FileWriter(mavenRules));
377 out.println("# Maven clean ignore rules - ignore some Maven dependencies and plugins during the clean phase");
378 out.println("# Format of this file is:");
379 out.println("# [group] [artifact] [type] [version]");
380 out.println("# where each element can be either");
381 out.println("# - the exact string, for example org.apache for the group, or 3.1");
382 out.println("# for the version. In this case, the element is simply matched");
383 out.println("# and left as it is");
384 out.println("# - * (the star character, alone). In this case, anything will");
385 out.println("# match and be left as it is. For example, using * on the");
386 out.println("# position of the artifact field will match any artifact id");
387 out.println("# All elements much match before a rule can be applied");
388 out.println("# Example rule: match jar with groupid= junit, artifactid= junit");
389 out.println("# and version starting with 3., this dependency is then removed");
390 out.println("# from the POM");
391 out.println("# junit junit jar s/3\\..*/3.x/");
392
393 for (Iterator i = cleanIgnoreRules.iterator(); i.hasNext();) {
394 String rule = (String) i.next();
395 out.println(rule);
396 }
397
398 out.flush();
102399 out.close();
103400 } catch (IOException ex) {
104401 Logger.getLogger(DependenciesSolver.class.getName()).log(Level.SEVERE, null, ex);
121418 depVars.put("maven.Depends", toString(runtimeDepends));
122419 depVars.put("maven.OptionalDepends", toString(optionalDepends));
123420 Set docRuntimeDepends = new TreeSet();
124 docRuntimeDepends.add("openjdk-6-doc | classpath-doc");
421 docRuntimeDepends.add("default-jdk-doc");
125422 for (Iterator i = runtimeDepends.iterator(); i.hasNext();) {
126423 docRuntimeDepends.add(i.next() + "-doc");
127424 }
224521 }
225522 }
226523
227 for (Iterator i = issues.iterator(); i.hasNext();) {
228 String issue = (String) i.next();
229 System.err.println(issue);
524 resolveDependenciesNow();
525
526 if (!issues.isEmpty()) {
527 System.err.println("WARNING:");
528 for (Iterator i = issues.iterator(); i.hasNext();) {
529 String issue = (String) i.next();
530 System.err.println(issue);
531 }
532 System.err.println("--------");
230533 }
231534 }
232535
235538 String pomRelPath = projectPom.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
236539 try {
237540 POMInfo pom = reader.readPom(projectPom);
541 pom.setProperties(new HashMap());
542 pom.getProperties().put("debian.package", getPackageName());
543 // System.out.println("Register POM " + pom.getThisPom().getGroupId() + ":" + pom.getThisPom().getArtifactId()
544 // + ":" + pom.getThisPom().getVersion());
238545 repository.registerPom(projectPom, pom);
546
547 if (filterModules) {
548 System.out.println("Include the module " + pomRelPath + " ?");
549 System.out.print("[y]/n > ");
550 String s = System.console().readLine().trim().toLowerCase();
551 boolean includeModule = !s.startsWith("n");
552 if (!includeModule) {
553 pomsConfig.add(pomRelPath + " --ignore");
554 String type = "*";
555 if (pom.getThisPom().getType() != null) {
556 type = pom.getThisPom().getType();
557 }
558 ignoreRules.add(pom.getThisPom().getGroupId() + " " + pom.getThisPom().getArtifactId()
559 + " " + type + " *");
560 return;
561 }
562 }
239563
240564 boolean noParent = false;
241565 if (pom.getParent() != null) {
242566 POMInfo parentPom = repository.searchMatchingPOM(pom.getParent());
243 if (parentPom == null) {
567 if (parentPom == null || parentPom.equals(repository.getSuperPOM())) {
244568 noParent = true;
245569 }
246570 if (!baseDir.equals(projectPom.getParentFile())) {
247 System.out.println("Check the parent dependency in the sub project " + projectPom);
571 // System.out.println("Checking the parent dependency in the sub project " + projectPom);
248572 Set parentDependencies = new TreeSet();
249573 parentDependencies.add(pom.getParent());
250 resolveDependencies(parentDependencies, false, false);
251 }
252 }
253
574 resolveDependenciesLater(projectPom, parentDependencies, false, false, false);
575 }
576 }
577
578 projectPoms.add(pom.getThisPom());
254579 if (noParent) {
255580 pomsConfig.add(pomRelPath + " --no-parent");
256581 } else {
257582 pomsConfig.add(pomRelPath);
258583 }
259584
260 resolveDependencies(pom.getDependencies(), false, false);
261 resolveDependencies(pom.getPlugins(), true, true);
262 resolveDependencies(pom.getPluginDependencies(), true, true);
263 resolveDependencies(pom.getExtensions(), true, true);
264
265 if (exploreProjects) {
585 resolveDependenciesLater(projectPom, pom.getDependencies(), false, false, false);
586 resolveDependenciesLater(projectPom, pom.getDependencyManagement(), false, false, true);
587 resolveDependenciesLater(projectPom, pom.getPlugins(), true, true, false);
588 resolveDependenciesLater(projectPom, pom.getPluginDependencies(), true, true, false);
589 resolveDependenciesLater(projectPom, pom.getPluginManagement(), true, true, true);
590 resolveDependenciesLater(projectPom, pom.getExtensions(), true, true, false);
591
592 if (exploreProjects && !pom.getModules().isEmpty()) {
593 if (!nonInteractive && !askedToFilterModules) {
594 System.out.println("This project contains modules. Include all modules?");
595 System.out.print("[y]/n > ");
596 String s = System.console().readLine().trim().toLowerCase();
597 filterModules = s.startsWith("n");
598 }
266599 for (Iterator i = pom.getModules().iterator(); i.hasNext();) {
267600 String module = (String) i.next();
268601 File modulePom = new File(projectPom.getParent(), module + "/pom.xml");
276609 }
277610 }
278611
279 private void resolveDependencies(Collection poms, boolean buildTime, boolean mavenExtension) {
612 private void resolveDependenciesNow() {
613 for (Iterator i = toResolve.iterator(); i.hasNext();) {
614 ToResolve tr = (ToResolve) i.next();
615 tr.resolve();
616 i.remove();
617 }
618 }
619
620 private void resolveDependenciesLater(File sourcePom, Collection poms, boolean buildTime, boolean mavenExtension, boolean management) {
621 toResolve.add(new ToResolve(sourcePom, poms, buildTime, mavenExtension, management));
622 }
623
624 private void resolveDependencies(File sourcePom, Collection poms, boolean buildTime, boolean mavenExtension, boolean management) {
625 String sourcePomLoc = sourcePom.getAbsolutePath();
626 String baseDirPath = baseDir.getAbsolutePath();
627 sourcePomLoc = sourcePomLoc.substring(baseDirPath.length() + 1, sourcePomLoc.length());
628
629 nextDependency:
280630 for (Iterator i = poms.iterator(); i.hasNext();) {
281631 Dependency dependency = (Dependency) i.next();
632 if (containsDependencyIgnoreVersion(ignoredDependencies, dependency) ||
633 (management && isDefaultMavenPlugin(dependency))) {
634 continue;
635 }
636
637 boolean ignoreDependency = false;
638 if (canIgnorePlugin(dependency)) {
639 ignoreDependency = askIgnoreDependency(dependency, "This plugin is not useful for the build or its use is against Debian policies. Ignore this plugin?");
640 } else if (canIgnoreExtension(dependency)) {
641 ignoreDependency = askIgnoreDependency(dependency, "This extension is not useful for the build or its use is against Debian policies. Ignore this extension?");
642 } else if (canBeIgnoredPlugin(dependency)) {
643 ignoreDependency = askIgnoreDependency(dependency, "This plugin may be ignored in some cases. Ignore this plugin?");
644 } else if (!runTests) {
645 if ("test".equals(dependency.getScope())) {
646 ignoreDependency = askIgnoreDependency(dependency, "Tests are turned off. Ignore this test dependency?");
647 } else if (isTestPlugin(dependency)) {
648 ignoreDependency = askIgnoreDependency(dependency, "Tests are turned off. Ignore this test plugin?");
649 }
650 } else if (!generateJavadoc && isJavadocPlugin(dependency)) {
651 ignoreDependency = askIgnoreDependency(dependency, "Documentation is turned off. Ignore this documentation plugin?");
652 }
653
654 if (ignoreDependency) {
655 ignoredDependencies.add(dependency);
656 ignoreRules.add(dependency.getGroupId() + " " + dependency.getArtifactId() + " maven-plugin *");
657 continue;
658 }
659
282660 POMInfo pom = repository.searchMatchingPOM(dependency);
283661 if (pom == null && "maven-plugin".equals(dependency.getType())) {
284662 List matchingPoms = repository.searchMatchingPOMsIgnoreVersion(dependency);
285663 if (matchingPoms.size() > 1) {
286 issues.add("More than one version matches the plugin " + dependency.getGroupId() + ":" +
287 dependency.getArtifactId() + ":" + dependency.getVersion());
664 issues.add(sourcePomLoc + ": More than one version matches the plugin " + dependency.getGroupId() + ":"
665 + dependency.getArtifactId() + ":" + dependency.getVersion());
288666 }
289667 if (!matchingPoms.isEmpty()) {
290668 pom = (POMInfo) matchingPoms.get(0);
291 // Adapt the version of the plugin to what is in the repository
292 rules.add(dependency.getGroupId() + " " +
293 dependency.getArtifactId() + " maven-plugin s/.*/" + pom.getOriginalVersion() + "/");
669 // Don't add a rule to force the version of a Maven plugin, it's now done
670 // automatically at build time
294671 }
295672 }
296673 if (pom == null) {
297 issues.add("Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":" +
298 dependency.getArtifactId() + ":" + dependency.getVersion());
674 if (!management) {
675 issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
676 + dependency.getArtifactId() + ":" + dependency.getVersion());
677 }
299678 return;
300679 }
680
681 // Handle the case of Maven plugins built and used in a multi-module build:
682 // they need to be added to maven.cleanIgnoreRules to avoid errors during
683 // a mvn clean
684 if ("maven-plugin".equals(dependency.getType()) && containsDependencyIgnoreVersion(projectPoms, dependency)) {
685 cleanIgnoreRules.add(dependency.getGroupId() + " " + dependency.getArtifactId() + " maven-plugin *");
686 }
687
688 // Discover the library to import for the dependency
301689 String library = null;
302690 if (pom.getProperties() != null) {
303691 library = (String) pom.getProperties().get("debian.package");
304692 }
305693 if (library == null) {
306 issues.add("Dependency is missing the Debian properties in its POM: " + dependency.getGroupId() + ":" +
307 dependency.getArtifactId() + ":" + dependency.getVersion());
694 issues.add(sourcePomLoc + ": Dependency is missing the Debian properties in its POM: " + dependency.getGroupId() + ":"
695 + dependency.getArtifactId() + ":" + dependency.getVersion());
308696 File pomFile = new File(mavenRepo, dependency.getGroupId().replace(".", "/") + "/" + dependency.getArtifactId() + "/" + dependency.getVersion() + "/" + dependency.getArtifactId() + "-" + dependency.getVersion() + ".pom");
309697 library = searchPkg(pomFile);
310698 }
311 if (library != null) {
699 if (library != null && !library.equals(getPackageName())) {
312700 if (buildTime) {
313701 if ("test".equals(dependency.getScope())) {
314702 testDepends.add(library);
345733 }
346734 }
347735
736 private boolean containsDependencyIgnoreVersion(Collection dependencies, Dependency dependency) {
737 for (Iterator j = dependencies.iterator(); j.hasNext();) {
738 Dependency ignoredDependency = (Dependency) j.next();
739 if (ignoredDependency.equalsIgnoreVersion(dependency)) {
740 return true;
741 }
742 }
743 return false;
744 }
745
348746 private String searchPkg(File pomFile) {
349747 GetPackageResult packageResult = new GetPackageResult();
350748 executeProcess(new String[]{"dpkg", "--search", pomFile.getAbsolutePath()}, packageResult);
480878 System.out.println(" -i<rules>, --published-rules=<rules>: path to the file containing the");
481879 System.out.println(" extra rules to publish in the property debian.mavenRules in the cleaned POM");
482880 System.out.println(" --ant: use ant for the packaging");
881 System.out.println(" --run-tests: run the unit tests");
882 System.out.println(" --generate-javadoc: generate Javadoc");
483883 return;
484884 }
485885 DependenciesSolver solver = new DependenciesSolver();
500900 debianPackage = arg.substring(2);
501901 } else if (arg.startsWith("--package=")) {
502902 debianPackage = arg.substring("--package=".length());
503 } else if (arg.startsWith("--ant")) {
903 } else if (arg.equals("--ant")) {
504904 packageType = "ant";
905 } else if (arg.equals("--run-tests")) {
906 solver.setRunTests(true);
907 } else if (arg.equals("--generate-javadoc")) {
908 solver.setGenerateJavadoc(true);
505909 }
506910 i = inc(i, args);
507911 }
912 File poms = new File(solver.getOutputDirectory(), debianPackage + ".poms");
508913
509914 solver.setPackageName(debianPackage);
510915 solver.setPackageType(packageType);
511916 solver.setExploreProjects(true);
917 solver.setListOfPoms(poms);
512918
513919 if (verbose) {
514920 System.out.println("Solving dependencies for package " + debianPackage);
518924
519925 solver.saveListOfPoms();
520926 solver.saveMavenRules();
927 solver.saveMavenIgnoreRules();
928 solver.saveMavenCleanIgnoreRules();
929 solver.saveMavenPublishedRules();
521930 solver.saveSubstvars();
522931 }
523932
527936 } while (i < args.length && args[i].isEmpty());
528937 return i;
529938 }
530
531939 }
2020 Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant-optional, maven-ant-helper (>> 4)
2121 Build-Depends-Indep: maven-repo-helper,
2222 #printDependencies($compileDependencies)$space
23 Standards-Version: 3.8.2
23 Standards-Version: 3.8.3
2424 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
25 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}/
25 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
2626 Homepage:#if(${project.Url}) ${project.Url} #else TODO #end
2727
2828
1919 Uploaders: ${packager} <${packagerEmail}>
2020 Build-Depends: debhelper (>= 7), cdbs, default-jdk, maven-debian-helper
2121 Build-Depends-Indep:#printDependencies($compileDependencies)$space
22 Standards-Version: 3.8.2
22 Standards-Version: 3.8.3
2323 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
24 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}/
24 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
2525 Homepage:#if(${project.Url}) ${project.Url} #else TODO #end
2626
2727
6161
6262
6363 Files: debian/*
64 Copyright: Copyright ${currentYear}, ${packager} <${packagerEmail}>
64 Copyright: ${currentYear}, ${packager} <${packagerEmail}>
6565 License: ${packagerLicense}
6666 #set ($license = "${packagerLicense}")
6767 #set ($license = $license.replace("+",""))
0 #set( $H = '#' )
1 $H Include here properties to pass to Maven during the build.
2 $H For example:
3 $H maven.test.skip=true
4
05 #if(!$runTests)
16 maven.test.skip=true
27 #end
1010 <modules>
1111 <module>maven-debian-helper</module>
1212 <module>maven-debian-plugin</module>
13 <module>maven-build-no-docs</module>
1314 <module>maven-packager-utils</module>
1415 </modules>
1516
3031 <version>1.5.8</version>
3132 </dependency>
3233 </dependencies>
33 </project>
34 </project>
2727
2828 # Declare Build-Deps for packages using this file
2929 CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), cdbs (>= 0.4.43)
30 CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), maven-debian-helper (>> 0.3)
30 CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), maven-debian-helper (>> 0.7)
3131
3232 # Maven home directory. Doesn't need to be changed except when using
3333 # nonstandard Maven installations.
3434 MAVEN_HOME = /usr/share/maven2
3535
3636 MAVEN_DEBIAN_VERSION = $(shell ls /usr/share/maven-repo/org/debian/maven/maven-packager-utils/ | sed 's|/||')
37 MAVEN_CLASSCONF = /etc/maven2/m2-debian.conf
3738
3839 # The home directory of the Java Runtime Environment (JRE) or Java Development
3940 # Kit (JDK). You can either directly set JAVA_HOME in debian/rules or set
6566 # Extra arguments for the mh_patchpoms command line
6667 DEB_PATCHPOMS_ARGS=
6768
69 # The name of the binary package that gets the jar files installed. The
70 # first package by default.
71 DEB_JAR_PACKAGE = $(firstword $(shell dh_listpackages))
72
73 # The name of the package containing the documentation. The second package
74 # by default. Leave empty to skip generating documentation.
75 DEB_DOC_PACKAGE = $(firstword $(shell dh_listpackages | grep -v $(DEB_JAR_PACKAGE) | grep "-doc"))
76
6877 # Property file for Maven, defaults to debian/maven.properties if it exists.
6978 # You may define additional properties. Please note that command-line
7079 # arguments in MAVEN_ARGS (see below) override the settings in pom.xml and
7584 # command-line arguments in MAVEN_ARGS. You can additionally define
7685 # MAVEN_ARGS_<package> for each individual package.
7786 DEB_MAVEN_INVOKE = cd $(DEB_BUILDDIR) && $(JAVACMD) -noverify -cp $(DEB_CLASSPATH) \
78 $(JAVA_OPTS) -Dclassworlds.conf=/etc/maven2/m2-debian.conf \
87 $(JAVA_OPTS) -Dclassworlds.conf=$(MAVEN_CLASSCONF) \
7988 org.codehaus.classworlds.Launcher $(DEB_MAVEN_ARGS) \
8089 -s/etc/maven2/settings-debian.xml \
8190 -Dmaven.repo.local=$(DEB_MAVEN_REPO) \
8291 $(if $(MAVEN_ARGS_$(cdbs_curpkg)),$(MAVEN_ARGS_$(cdbs_curpkg)),$(MAVEN_ARGS))
83
84 # The name of the binary package that gets the jar files installed. The
85 # first package by default.
86 DEB_JAR_PACKAGE = $(firstword $(shell dh_listpackages))
87
88 # The name of the package containing the documentation. The second package
89 # by default. Leave empty to skip generating documentation.
90 DEB_DOC_PACKAGE = $(word 2, $(shell dh_listpackages))
9192
9293 # Targets to invoke for building, installing, testing and cleaning up.
9394 # Building uses the default target from build.xml, installing and testing is
5656 debian/maven.rules:
5757 mh_lspoms -p$(DEB_JAR_PACKAGE) --force
5858
59 debian/stamp-poms-patched:
60 mh_patchpoms -p$(DEB_JAR_PACKAGE) --keep-pom-version $(DEB_PATCHPOMS_ARGS)
59 ifeq (, $(DEB_DOC_PACKAGE))
60 DEB_PATCHPOMS_ARGS += --build-no-docs
61 debian/stamp-maven-build: override MAVEN_CLASSCONF = /etc/maven2/m2-debian-nodocs.conf
62 endif
63
64 debian/stamp-poms-patched: debian/maven-repo
65 mh_patchpoms -p$(DEB_JAR_PACKAGE) --debian-build --keep-pom-version --maven-repo=$(DEB_MAVEN_REPO) $(DEB_PATCHPOMS_ARGS)
6166 touch debian/stamp-poms-patched
6267
6368 patch-poms: debian/$(DEB_JAR_PACKAGE).poms debian/maven.rules debian/stamp-poms-patched
7883 $(DEB_MAVEN_INVOKE) $(DEB_MAVEN_BUILD_TARGET)
7984 touch $@
8085
86 cleanbuilddir:: DEB_PATCHPOMS_ARGS += --clean-ignore-rules=debian/maven.cleanIgnoreRules
8187 cleanbuilddir:: maven-sanity-check post-patches debian/maven-repo
8288 -$(DEB_MAVEN_INVOKE) $(DEB_MAVEN_CLEAN_TARGET)
8389 $(RM) -r $(DEB_MAVEN_REPO) debian/stamp-maven-build
8490 $(if $(cdbs_new_poms_file), $(RM) debian/$(DEB_JAR_PACKAGE).poms)
8591 $(if $(cdbs_new_maven_rules_file), $(RM) debian/maven.rules)
8692 $(if $(cdbs_use_maven_substvars), $(RM) debian/*.substvars)
93 $(MAKE) -f debian/rules unpatch-poms
8794
8895 # extra arguments for the installation step
89 PLUGIN_ARGS = -Ddebian.dir=$(CURDIR)/debian -Ddebian.package=$(DEB_JAR_PACKAGE)
96 PLUGIN_ARGS = -Ddebian.dir=$(CURDIR)/debian -Ddebian.package=$(DEB_JAR_PACKAGE) -Dmaven.repo.local=$(DEB_MAVEN_REPO)
9097
9198 common-install-arch common-install-indep:: common-install-impl
9299 common-install-impl::
93100 $(if $(DEB_MAVEN_INSTALL_TARGET),$(DEB_MAVEN_INVOKE) $(PLUGIN_ARGS) $(DEB_MAVEN_INSTALL_TARGET),@echo "DEB_MAVEN_INSTALL_TARGET unset, skipping default maven.mk common-install target")
94 $(if $(cdbs_use_maven_substvars), mh_resolve_dependencies -p$(DEB_JAR_PACKAGE))
101 $(if $(cdbs_use_maven_substvars), mh_resolve_dependencies --non-interactive -p$(DEB_JAR_PACKAGE))
95102
96103 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
97104 common-build-arch common-build-indep:: debian/stamp-maven-check