Codebase list maven-debian-helper / 03de585
* d/control: Add Recommends on devscripts (which provides licensecheck) * mh_make: - Improve generated copyright - Fix generated rules for a build using ant - When ignoring dependencies, don't fail the build - When ant is used as the build tool, generate the build.xml file required for multi projects. - use licensecheck as an additional source of information for licenses Ludovic Claude 13 years ago
29 changed file(s) with 802 addition(s) and 206 deletion(s). Raw diff Collapse all Expand all
109109 read -p "[y]/n > " RUN
110110 RUN_TESTS="true"
111111 if [ "$RUN" == "n" ]; then
112 RUN_TESTS="false"
112 RUN_TESTS=
113113 fi
114114 fi
115115
119119 read -p "[y]/n > " GEN
120120 GEN_JAVADOC="true"
121121 if [ "$GEN" == "n" ]; then
122 GEN_JAVADOC="false"
123 fi
124 fi
125
126 if [ -n "$FROM_SVN" ]; then
127 echo
128 SVN_OPTIONS=
129 if [[ "$FROM_SVN" =~ https://.*\.dev\.java\.net/.* ]]; then
130 echo "Press enter if a password is asked"
131 SVN_OPTIONS="--username guest"
132 fi
133 svn export $FROM_SVN $PACKAGE $SVN_OPTIONS
134 cd $PACKAGE
135 fi
136
137 if [ -e pom.xml.save ]; then
138 mh_unpatchpoms -p$BIN_PACKAGE
122 GEN_JAVADOC=
123 fi
139124 fi
140125
141126 echo
146131 echo "Warning: apt-file doesn't seem to be configured"
147132 echo "Running sudo apt-file update"
148133 sudo apt-file update
134 else
135 echo '[ok]'
149136 fi
150137 else
151138 echo "Warning: apt-file doesn't seem to be installed"
155142 fi
156143
157144 echo
158 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} ${VERBOSE:+--verbose} --maven-repo=/usr/share/maven-repo
145 echo "Checking that licensecheck is installed..."
146 if [ ! -f /usr/bin/licensecheck ]; then
147 echo "Warning: licensecheck doesn't seem to be installed"
148 echo "Installing licensecheck using sudo apt-get install devscripts"
149 sudo apt-get install devscripts
150 else
151 echo '[ok]'
152 fi
153
154 if [ -n "$FROM_SVN" ]; then
155 echo
156 echo "Downloading the upstream sources..."
157 SVN_OPTIONS=
158 if [[ "$FROM_SVN" =~ https://.*\.dev\.java\.net/.* ]]; then
159 echo "Press enter if a password is asked"
160 SVN_OPTIONS="--username guest"
161 fi
162 svn export $FROM_SVN $PACKAGE $SVN_OPTIONS
163 cd $PACKAGE
164 fi
165
166 if [ -e pom.xml.save ]; then
167 mh_unpatchpoms -p$BIN_PACKAGE
168 fi
169
170 # Restore state after a brutal stop
171 if [ -f debian/$BIN_PACKAGE.poms ]; then
172 mh_unpatchpoms -p$BIN_PACKAGE
173 fi
174 if [ -f debian/patches/series ]; then
175 quilt pop -a
176 fi
177
178 # Apply existing quilt patchs as source 3(quilt) is used in the package
179 if [ -f debian/patches/series ]; then
180 quilt push -a
181 fi
182
183 echo
184 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 --verbose --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} ${VERBOSE:+--verbose} --maven-repo=/usr/share/maven-repo
159185
160186 if [ $? != 0 ]; then
187 if [ -f debian/patches/series ]; then
188 quilt pop -a
189 fi
161190 exit 1
162191 fi
163192
168197 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
169198
170199 if [ $? != 0 ]; then
200 if [ -f debian/$BIN_PACKAGE.poms ]; then
201 mh_unpatchpoms -p$BIN_PACKAGE
202 fi
203 if [ -f debian/patches/series ]; then
204 quilt pop -a
205 fi
171206 exit 1
172207 fi
173208
176211 dch --create --newversion=${debianVersion}-1 --package=$PACKAGE "Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>"
177212 fi
178213
179 mh_unpatchpoms -p$BIN_PACKAGE
180 rm -f debian/*.substvars
214 if [ -f debian/$BIN_PACKAGE.poms ]; then
215 mh_unpatchpoms -p$BIN_PACKAGE
216 fi
217 if [ -f debian/patches/series ]; then
218 quilt pop -a
219 fi
220
221 rm -f debian/*.substvars
222 rm -f .debianVersion
0 maven-debian-helper (1.4) experimental; urgency=low
1
2 * d/control: Add Recommends on devscripts (which provides licensecheck)
3 * mh_make:
4 - Improve generated copyright
5 - Fix generated rules for a build using ant
6 - When ignoring dependencies, don't fail the build
7 - When ant is used as the build tool, generate the build.xml file
8 required for multi projects.
9 - use licensecheck as an additional source of information for licenses
10
11 -- Ludovic Claude <ludovic.claude@laposte.net> Fri, 12 Nov 2010 12:26:37 +0100
12
013 maven-debian-helper (1.3) experimental; urgency=low
114
215 * ${maven:Depends} and similar substitution vars: add
1717 libmaven-clean-plugin-java, libmaven-resources-plugin-java,
1818 libmaven-compiler-plugin-java, libmaven-jar-plugin-java, libmaven-site-plugin-java,
1919 libsurefire-java, velocity, libplexus-velocity-java
20 Recommends: apt-file, subversion
20 Recommends: apt-file, devscripts, subversion
2121 Suggests: libmaven-javadoc-plugin-java
2222 Description: Helper tools for building Debian packages with Maven
2323 Maven is a software project management and comprehension tool. Based on the
00 package org.debian.maven;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import java.io.FileInputStream;
319 import java.io.IOException;
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import java.io.File;
319
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import java.io.File;
319
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 /**
319 * resolves compile dependencies
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import org.apache.maven.plugin.AbstractMojo;
319 import org.apache.maven.plugin.MojoExecutionException;
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 /**
319 * resolves runtime dependencies
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 /**
319 * resolves test dependencies
00 package org.debian.maven.plugin;
11
22 import java.io.IOException;
3
4 /*
5 * Copyright 2009 Torsten Werner, Ludovic Claude.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
319
420 /**
521 * Install the javadoc jar.
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner, Ludovic Claude.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import java.io.File;
319 import java.io.FileReader;
00 package org.debian.maven.plugin;
1
2 /*
3 * Copyright 2009 Torsten Werner, Ludovic Claude.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
117
218 import java.io.IOException;
319 import org.codehaus.plexus.util.FileUtils;
1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17
1718 import org.apache.maven.plugin.AbstractMojo;
1819 import org.apache.maven.plugin.MojoExecutionException;
1920
1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17
1718 import java.io.*;
1819 import java.util.*;
1920 import java.util.logging.Level;
132133 private List toResolve = new ArrayList();
133134 private Set knownProjectDependencies = new TreeSet();
134135 private Set ignoredDependencies = new TreeSet();
136 private Set notIgnoredDependencies = new TreeSet();
135137 private Set compileDepends = new TreeSet();
136138 private Set testDepends = new TreeSet();
137139 private Set runtimeDepends = new TreeSet();
163165 cleanIgnoreRules.setDescription(readResource("maven.cleanIgnoreRules.description"));
164166 cleanIgnoreRules.setWarnRulesFileNotFound(false);
165167 cleanIgnoreRules.setVerbose(true);
168 cleanIgnoreRules.setDontDuplicate(pomTransformer.getIgnoreRules());
166169
167170 Rule toDebianRule = new Rule("s/.*/debian/");
168171 toDebianRule.setDescription("Change the version to the symbolic 'debian' version");
192195 return sb.toString();
193196 }
194197
198 public boolean isRunTests() {
199 return runTests;
200 }
201
195202 public void setRunTests(boolean b) {
196203 this.runTests = b;
197204 }
200207 this.offline = offline;
201208 }
202209
203 private void setGenerateJavadoc(boolean b) {
210 public boolean isGenerateJavadoc() {
211 return generateJavadoc;
212 }
213
214 public void setGenerateJavadoc(boolean b) {
204215 this.generateJavadoc = b;
205216 }
206217
261272 }
262273
263274 private boolean askIgnoreDependency(String sourcePomLoc, Dependency dependency, String message, boolean defaultToIgnore) {
264 if (!interactive) {
275 if (!interactive || notIgnoredDependencies.contains(dependency)) {
265276 return false;
266277 }
267278 System.out.println();
274285 System.out.print("y/[n] > ");
275286 }
276287 String s = readLine().toLowerCase();
277 if (defaultToIgnore) {
278 return !s.startsWith("n");
279 } else {
280 return s.startsWith("y");
281 }
288 boolean ignore = defaultToIgnore ? !s.startsWith("n") : s.startsWith("y");
289 if (!ignore) {
290 notIgnoredDependencies.add(dependency);
291 }
292 return ignore;
282293 }
283294
284295 public boolean isInteractive() {
331342 }
332343
333344 public void saveMavenRules() {
345 // Don't save implicit rules
346 pomTransformer.getRules().remove(DependencyRule.TO_DEBIAN_VERSION_RULE);
347 pomTransformer.getRules().remove(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
334348 pomTransformer.getRules().save();
335349 }
336350
337351 public void saveMavenPublishedRules() {
352 // Don't save implicit rules
353 pomTransformer.getPublishedRules().remove(DependencyRule.TO_DEBIAN_VERSION_RULE);
354 pomTransformer.getPublishedRules().remove(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
338355 pomTransformer.getPublishedRules().save();
339356 }
340357
539556 pom.setParent(null);
540557 } else if (pom.getParent() != null) {
541558 boolean oldNoParent = getPOMOptions(projectPom).isNoParent();
542 pom.setParent(resolveDependency(pom.getParent(), projectPom, true, false, false, true));
559 // Don't mark the parent dependency as 'build time' dependency because once installed,
560 // the POM for this project will always need the parent POM to be available
561 pom.setParent(resolveDependency(pom.getParent(), projectPom, false, false, false, true));
543562 if (getPOMOptions(projectPom).isNoParent() != oldNoParent) {
544563 resetPOM(projectPom);
545564 pom = getPOM(projectPom);
547566 }
548567
549568 getRepository().registerPom(projectPom, pom);
569 // Also register automatically the test jar which may accompany the current jar and be
570 // used in another module of the same project
571 if ("jar".equals(pom.getThisPom().getType())) {
572 POMInfo testPom = (POMInfo) pom.clone();
573 testPom.getThisPom().setType("test-jar");
574 getRepository().registerPom(projectPom, testPom);
575 }
550576
551577 knownProjectDependencies.add(pom.getThisPom());
552578
589615 i.hasNext(); ) {
590616 DependencyRule previousRule = (DependencyRule) i.next();
591617 if (!previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
592 !previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
618 !previousRule.equals(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE) &&
593619 previousRule.matches(pom.getThisPom())) {
594620 explicitlyMentionedInRules = true;
595621 break;
715741 noParent = options.isNoParent();
716742 hasPackageVersion = options.getHasPackageVersion();
717743 }
744
718745 info = pomTransformer.transformPom(projectPom, tmpDest, noParent, hasPackageVersion, false, false, null, null, true);
719746 pomInfoCache.put(projectPom.getAbsolutePath(), info);
720747 return info;
779806 String baseDirPath = baseDir.getAbsolutePath();
780807 sourcePomLoc = sourcePomLoc.substring(baseDirPath.length() + 1, sourcePomLoc.length());
781808 if (verbose) {
782 System.out.println("Resolving " + dependency);
783 }
809 String msg = "Resolving " + dependency;
810 if (dependency.getScope() != null) {
811 msg += " of scope " + dependency.getScope();
812 }
813 System.out.println(msg + "...");
814 }
815
816 // First let the packager mark as ignored those dependencies which should be ignored
784817 boolean ignoreDependency = false;
785 if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
786 ignoreDependency = true;
787 } else if (canIgnorePlugin(dependency)) {
818 if (!ignoreDependency && canIgnorePlugin(dependency)) {
788819 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin is not useful for the build or its use is against Debian policies. Ignore this plugin?");
789 } else if (canIgnoreExtension(dependency)) {
820 }
821 if (!ignoreDependency && canIgnoreExtension(dependency)) {
790822 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This extension is not useful for the build or its use is against Debian policies. Ignore this extension?");
791 } else if (canBeIgnoredPlugin(dependency)) {
823 }
824 if (!ignoreDependency && canBeIgnoredPlugin(dependency)) {
792825 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin may be ignored in some cases. Ignore this plugin?");
793 } else if (!runTests) {
826 }
827 if (!ignoreDependency && !runTests) {
794828 if ("test".equals(dependency.getScope())) {
795829 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Tests are turned off. Ignore this test dependency?");
796830 } else if (isTestPlugin(dependency)) {
797831 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Tests are turned off. Ignore this test plugin?");
798832 }
799 } else if (!generateJavadoc && isDocumentationOrReportPlugin(dependency)) {
833 }
834 if (!ignoreDependency && !generateJavadoc && isDocumentationOrReportPlugin(dependency)) {
800835 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Documentation is turned off. Ignore this documentation plugin?");
801836 }
802837
804839 ignoredDependencies.add(dependency);
805840 String ruleDef = dependency.getGroupId() + " " + dependency.getArtifactId() + " * *";
806841 pomTransformer.getIgnoreRules().add(new DependencyRule(ruleDef));
842 if (verbose) {
843 System.out.println("[ignored]");
844 }
845 return null;
846 }
847
848 // Automatically skip some dependencies when ant packaging is used
849 boolean skipDependency = false;
850 String skipReason = "";
851 if (packageType.equals("ant")) {
852 if ("maven-plugin".equals(dependency.getType())) {
853 try {
854 if (!getPOM(sourcePom).getThisPom().getType().equals("pom")) {
855 skipDependency = true;
856 skipReason = "Maven plugins are not used during a build with Ant";
857 }
858 } catch (Exception e) {
859 e.printStackTrace();
860 }
861 }
862 if (!runTests && "test".equals(dependency.getScope())) {
863 skipDependency = true;
864 skipReason = "Tests are not executed during the build";
865 }
866 }
867 if (skipDependency) {
868 // Even if we skip the dependency, try to locate its associated maven rules,
869 // as this may be useful later - but never fail if the dependency is not found.
870 POMInfo pom = getRepository().searchMatchingPOM(dependency);
871 if (pom != null) {
872 String mavenRules = (String) pom.getProperties().get("debian.mavenRules");
873 if (mavenRules != null) {
874 StringTokenizer st = new StringTokenizer(mavenRules, ",");
875 while (st.hasMoreTokens()) {
876 String ruleDef = st.nextToken().trim();
877 pomTransformer.getRules().add(new DependencyRule(ruleDef));
878 }
879 }
880 }
881 if (verbose) {
882 if (!skipReason.isEmpty()) {
883 System.out.println("[skipped - " + skipReason + "]");
884 } else {
885 System.out.println("[skipped]");
886 }
887 }
807888 return null;
808889 }
809890
835916
836917 if (pom == null) {
837918 if (management) {
919 if (verbose) {
920 System.out.println("[skipped dependency or plugin management]");
921 }
838922 return null;
923 } else if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
924 if (verbose) {
925 System.out.println("[skipped - not used in Ant build]");
926 }
927 return null;
839928 } else {
840929 if (!ignoreDependency) {
841930 if (resolvingParent) {
843932 "The parent POM cannot be found in the Maven repository for Debian. Ignore it?");
844933 getPOMOptions(sourcePom).setNoParent(noParent);
845934 if (noParent) {
935 if (verbose) {
936 System.out.println("[no-parent]");
937 }
846938 return null;
847939 }
848940 } else if (isDocumentationOrReportPlugin(dependency)) {
849941 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency,
850942 "This documentation or report plugin cannot be found in the Maven repository for Debian. Ignore this plugin?");
851943 } else if ("maven-plugin".equals(dependency.getType())) {
852 issues.add(sourcePomLoc + ": Plugin is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
853 + dependency.getArtifactId() + ":" + dependency.getVersion());
854944 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin cannot be found in the Debian Maven repository. Ignore this plugin?", false);
945 if (!ignoreDependency) {
946 issues.add(sourcePomLoc + ": Plugin is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
947 + dependency.getArtifactId() + ":" + dependency.getVersion());
948 }
855949 } else {
856 issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
857 + dependency.getArtifactId() + ":" + dependency.getVersion());
858950 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This dependency cannot be found in the Debian Maven repository. Ignore this dependency?", false);
951 if (!ignoreDependency) {
952 issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
953 + dependency.getArtifactId() + ":" + dependency.getVersion());
954 }
859955 }
860956 }
861957 if (ignoreDependency) {
862958 ignoredDependencies.add(dependency);
863959 String ruleDef = dependency.getGroupId() + " " + dependency.getArtifactId() + " * *";
864960 pomTransformer.getIgnoreRules().add(new DependencyRule(ruleDef));
961 if (verbose) {
962 System.out.println("[ignored]");
963 }
865964 return null;
866965 } else {
867966 String pkg = searchPkg(new File("/usr/share/maven-repo/"
879978 return resolveDependency(dependency, sourcePom, buildTime, mavenExtension, management);
880979 }
881980 }
981 if (verbose) {
982 System.out.println("[error]");
983 }
882984 throw new DependencyNotFoundException(dependency);
883985 }
884986 }
9451047 String ruleDef = st.nextToken().trim();
9461048 pomTransformer.getRules().add(new DependencyRule(ruleDef));
9471049 }
1050 }
1051 if (verbose) {
1052 System.out.println("[ok]");
9481053 }
9491054 return pom.getThisPom();
9501055 }
11131218 System.out.println(" --generate-javadoc: generate Javadoc");
11141219 System.out.println(" --non-interactive: non interactive session");
11151220 System.out.println(" --offline: offline mode for Debian build compatibility");
1221 System.out.println(" -m<repo root>--maven-repo=<repo root>: location of the Maven repository,");
1222 System.out.println(" used to force the versions of the Maven plugins used in the current");
1223 System.out.println(" POM file with the versions found in the repository");
11161224 return;
11171225 }
11181226 DependenciesSolver solver = new DependenciesSolver();
11251233 boolean verbose = false;
11261234 String debianPackage = "";
11271235 String packageType = "maven";
1236 File mavenRepo = null;
11281237 while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().isEmpty())) {
11291238 String arg = args[i].trim();
11301239 if ("--verbose".equals(arg) || "-v".equals(arg)) {
11431252 solver.setInteractive(false);
11441253 } else if (arg.equals("--offline")) {
11451254 solver.setOffline(true);
1255 } else if (arg.startsWith("-m")) {
1256 mavenRepo = new File(arg.substring(2));
1257 } else if (arg.startsWith("--maven-repo=")) {
1258 mavenRepo = new File(arg.substring("--maven-repo=".length()));
11461259 }
11471260 i = inc(i, args);
11481261 }
11531266 solver.setExploreProjects(true);
11541267 solver.setListOfPoms(poms);
11551268
1269 if (mavenRepo != null) {
1270 Repository repository = new Repository(mavenRepo);
1271 solver.getPomTransformer().setRepository(repository);
1272 solver.getPomTransformer().usePluginVersionsFromRepository();
1273 }
1274
11561275 if (verbose) {
1157 System.out.println("Solving dependencies for package " + debianPackage);
1276 String msg = "Solving dependencies for package " + debianPackage;
1277 if (solver.isRunTests()) {
1278 msg += " (tests are included)";
1279 }
1280 if (solver.isGenerateJavadoc()) {
1281 msg += " (documentation is included)";
1282 }
1283 System.out.println(msg);
11581284 solver.setVerbose(true);
11591285 }
11601286
1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17
1718 import org.apache.maven.model.Developer;
1819 import org.apache.maven.model.License;
1920 import org.apache.maven.plugin.AbstractMojo;
153154 context.put("packager", packager);
154155 context.put("packagerEmail", email);
155156 context.put("project", project);
157 context.put("collectedProjects", collectedProjects);
156158 context.put("runTests", Boolean.valueOf(runTests));
157159 context.put("generateJavadoc", Boolean.valueOf(generateJavadoc));
158160
165167 project.setUrl(readLine());
166168 }
167169
168 Set licenses = new TreeSet();
169 for (Iterator i = project.getLicenses().iterator(); i.hasNext(); ) {
170 License license = (License) i.next();
171 String licenseName = "";
172 if (license.getName() != null) {
173 licenseName = license.getName() + " ";
174 }
175 String licenseUrl = "";
176 if (license.getUrl() != null) {
177 licenseUrl = license.getUrl().toLowerCase();
178 }
179 boolean recognized = false;
180 if (licenseName.indexOf("mit ") >= 0 || licenseUrl.indexOf("mit-license") >= 0) {
181 licenses.add("MIT");
182 recognized = true;
183 } else if (licenseName.indexOf("bsd ") >= 0 || licenseUrl.indexOf("bsd-license") >= 0) {
184 licenses.add("BSD");
185 recognized = true;
186 } else if (licenseName.indexOf("artistic ") >= 0 || licenseUrl.indexOf("artistic-license") >= 0) {
187 licenses.add("Artistic");
188 recognized = true;
189 } else if (licenseName.indexOf("apache ") >= 0 || licenseUrl.indexOf("apache") >= 0) {
190 if (licenseName.indexOf("2.") >= 0 || licenseUrl.indexOf("2.") >= 0) {
191 licenses.add("Apache-2.0");
192 recognized = true;
193 } else if (licenseName.indexOf("1.0") >= 0 || licenseUrl.indexOf("1.0") >= 0) {
194 licenses.add("Apache-1.0");
195 recognized = true;
196 } else if (licenseName.indexOf("1.1") >= 0 || licenseUrl.indexOf("1.1") >= 0) {
197 licenses.add("Apache-1.1");
198 recognized = true;
199 }
200 } else if (licenseName.indexOf("lgpl ") >= 0 || licenseUrl.indexOf("lgpl") >= 0) {
201 if (licenseName.indexOf("2.1") >= 0 || licenseUrl.indexOf("2.1") >= 0) {
202 licenses.add("LGPL-2.1");
203 recognized = true;
204 } else if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
205 licenses.add("LGPL-2");
206 recognized = true;
207 } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
208 licenses.add("LGPL-2");
209 recognized = true;
210 }
211 } else if (licenseName.indexOf("gpl ") >= 0 || licenseUrl.indexOf("gpl") >= 0) {
212 if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
213 licenses.add("GPL-2");
214 recognized = true;
215 } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
216 licenses.add("GPL-3");
217 recognized = true;
218 }
219 }
220 if (!recognized) {
221 System.out.println("License " + licenseName + licenseUrl + " was not recognized, please enter a license name preferably in one of:");
222 System.out.println("Apache Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel");
223 System.out.println("Expat GPL LGPL GFDL GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
224 String s = readLine();
225 if (s.length() > 0) {
226 licenses.add(s);
227 }
228 }
229 }
230 if (licenses.isEmpty()) {
231 System.out.println("License was not found, please enter a license name preferably in one of:");
232 System.out.println("Apache Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel");
233 System.out.println("Expat GPL LGPL GFDL GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
234 String s = readLine();
235 if (s.length() > 0) {
236 licenses.add(s);
237 }
238 }
170 Set licenses = discoverLicenses();
239171 context.put("licenses", licenses);
240172
241173 if (licenses.size() == 1) {
277209 if (projectTeam == null || projectTeam.isEmpty()) {
278210 projectTeam = project.getName() + " developers";
279211 }
280 context.put("copyrightOwner", copyrightOwner);
281212 context.put("projectTeam", projectTeam);
282213
283214 String copyrightYear;
382313 context.put("compileDependencies", depends);
383314 context.put("runtimeDependencies", split(substvars.getProperty("maven.Depends")));
384315 context.put("optionalDependencies", split(substvars.getProperty("maven.OptionalDepends")));
316 context.put("javadocDependencies", split(substvars.getProperty("maven.DocDepends")));
317 context.put("javadocOptionalDependencies", split(substvars.getProperty("maven.DocOptionalDepends")));
385318
386319 if ("ant".equals(packageType)) {
387320 Set buildJars = new TreeSet();
398331
399332 if ("ant".equals(packageType)) {
400333 ListOfPOMs listOfPOMs = new ListOfPOMs(new File(outputDirectory, binPackageName + ".poms"));
334 setupArtifactLocation(listOfPOMs, project);
401335 for (Iterator i = collectedProjects.iterator(); i.hasNext();) {
402336 MavenProject mavenProject = (MavenProject) i.next();
403 String basedir = project.getBasedir().getAbsolutePath();
404 String dirRelPath = mavenProject.getBasedir().getAbsolutePath().substring(basedir.length() + 1);
405 if (! "pom".equals(mavenProject.getPackaging())) {
406 String pomFile = dirRelPath + "/pom.xml";
407 listOfPOMs.getOrCreatePOMOptions(pomFile).setJavaLib(true);
408 String extension = mavenProject.getPackaging();
409 if (extension.equals("bundle")) {
410 extension = "jar";
411 }
412 if (extension.equals("webapp")) {
413 extension = "war";
414 }
415 if (mavenProject.getArtifact() != null && mavenProject.getArtifact().getFile() != null) {
416 extension = mavenProject.getArtifact().getFile().toString();
417 extension = extension.substring(extension.lastIndexOf('.') + 1);
418 }
419 listOfPOMs.getOrCreatePOMOptions(pomFile).setArtifact(dirRelPath + "/" + mavenProject.getArtifactId() + "-*."
420 + extension);
421 }
337 setupArtifactLocation(listOfPOMs, mavenProject);
422338 }
423339 listOfPOMs.save();
424340 }
464380 context.put("tagMarker", tagMarker);
465381 context.put("suffixUrl", suffixUrl);
466382
467 FileWriter out = new FileWriter(new File(outputDirectory, "watch"));
468 Velocity.mergeTemplate("watch.svn.vm", "UTF8", context, out);
469 out.flush();
470 out.close();
471
472 out = new FileWriter(new File(outputDirectory, "orig-tar.sh"));
473 Velocity.mergeTemplate("orig-tar.svn.vm", "UTF8", context, out);
474 out.flush();
475 out.close();
383 generateFile(context, "watch.svn.vm", outputDirectory, "watch");
384 generateFile(context, "orig-tar.svn.vm", outputDirectory, "orig-tar.sh");
476385
477386 makeExecutable("debian/orig-tar.sh");
478387
509418 }
510419
511420 if ("ant".equals(packageType)) {
421 boolean containsJars = false;
422 boolean containsPlugins = false;
423 if (project.getPackaging().equals("pom") && project.getModules().size() > 0) {
424 for (Iterator i = collectedProjects.iterator(); i.hasNext(); ) {
425 MavenProject module = (MavenProject) i.next();
426 if (module.getPackaging().equals("maven-plugin")) {
427 containsPlugins = true;
428 } else if (!module.getPackaging().equals("pom")) {
429 containsJars = true;
430 }
431 }
432 generateFile(context, "build.xml.vm", outputDirectory, "build.xml");
433 } else if (!project.getPackaging().equals("pom")) {
434 if (project.getPackaging().equals("maven-plugin")) {
435 containsPlugins = true;
436 } else if (!project.getPackaging().equals("pom")) {
437 containsJars = true;
438 }
439 }
440 context.put("containsJars", Boolean.valueOf(containsJars));
441 context.put("containsPlugins", Boolean.valueOf(containsPlugins));
512442 generateFile(context, "build.properties.ant.vm", outputDirectory, "build.properties");
443 generateFile(context, "build-classpath.vm", outputDirectory, "build-classpath");
513444 } else {
514445 generateFile(context, "maven.properties.vm", outputDirectory, "maven.properties");
515446 }
520451 } catch (Exception ex) {
521452 ex.printStackTrace();
522453 }
454 }
455
456 private void setupArtifactLocation(ListOfPOMs listOfPOMs, MavenProject mavenProject) {
457 String basedir = project.getBasedir().getAbsolutePath();
458 String dirRelPath = mavenProject.getBasedir().getAbsolutePath().substring(basedir.length() + 1);
459 if (! "pom".equals(mavenProject.getPackaging())) {
460 String pomFile = dirRelPath + "/pom.xml";
461 listOfPOMs.getOrCreatePOMOptions(pomFile).setJavaLib(true);
462 String extension = mavenProject.getPackaging();
463 if (extension.equals("bundle")) {
464 extension = "jar";
465 }
466 if (extension.equals("webapp")) {
467 extension = "war";
468 }
469 if (mavenProject.getArtifact() != null && mavenProject.getArtifact().getFile() != null) {
470 extension = mavenProject.getArtifact().getFile().toString();
471 extension = extension.substring(extension.lastIndexOf('.') + 1);
472 }
473 ListOfPOMs.POMOptions pomOptions = listOfPOMs.getOrCreatePOMOptions(pomFile);
474 pomOptions.setArtifact(dirRelPath + "/target/" + mavenProject.getArtifactId() + "-*."
475 + extension);
476 if ("jar".equals(extension) && generateJavadoc && "ant".equals(packageType)) {
477 String artifactId = mavenProject.getArtifact().getArtifactId();
478 String docPom = dirRelPath + "/target/" + artifactId + ".javadoc.pom";
479 listOfPOMs.getOrCreatePOMOptions(docPom).setIgnorePOM(true);
480 listOfPOMs.getOrCreatePOMOptions(docPom).setArtifact(dirRelPath + "/target/" + artifactId + ".javadoc.jar");
481 listOfPOMs.getOrCreatePOMOptions(docPom).setClassifier("javadoc");
482 listOfPOMs.getOrCreatePOMOptions(docPom).setHasPackageVersion(pomOptions.getHasPackageVersion());
483 listOfPOMs.getOrCreatePOMOptions(docPom).setDestPackage(packageName + "-doc");
484 }
485 pomOptions.setJavaLib(true);
486 if (mavenProject.getArtifactId().matches(packageName + "\\d")) {
487 pomOptions.setUsjName(packageName);
488 }
489 }
490 }
491
492 private Set discoverLicenses() {
493 Set licenses = new TreeSet();
494 for (Iterator i = project.getLicenses().iterator(); i.hasNext(); ) {
495 License license = (License) i.next();
496 String licenseName = "";
497 if (license.getName() != null) {
498 licenseName = license.getName() + " ";
499 }
500 String licenseUrl = "";
501 if (license.getUrl() != null) {
502 licenseUrl = license.getUrl();
503 }
504 boolean recognized = recognizeLicense(licenses, licenseName, licenseUrl);
505 if (!recognized) {
506 System.out.println("License " + licenseName + licenseUrl + " was not recognized, please enter a license name preferably in one of:");
507 printAvailableLicenses();
508 System.out.print("> ");
509 String s = readLine();
510 if (s.length() > 0) {
511 licenses.add(s);
512 }
513 }
514 }
515 LicenseCheckResult licenseResult = new LicenseCheckResult();
516 DependenciesSolver.executeProcess(new String[]{"/bin/sh", "-c", "licensecheck `find . -type f`"},
517 licenseResult);
518 for (Iterator i = licenseResult.getLicenses().iterator(); i.hasNext(); ) {
519 String license = (String) i.next();
520 boolean recognized = recognizeLicense(licenses, license, "");
521 if (!recognized) {
522 System.out.println("License " + license + " was not recognized, please enter a license name preferably in one of:");
523 printAvailableLicenses();
524 System.out.print("> ");
525 String s = readLine();
526 if (s.length() > 0) {
527 licenses.add(s);
528 }
529 }
530 }
531
532 if (licenses.isEmpty()) {
533 System.out.println("License was not found, please enter a license name preferably in one of:");
534 printAvailableLicenses();
535 System.out.print("> ");
536 String s = readLine();
537 if (s.length() > 0) {
538 licenses.add(s);
539 }
540 }
541 return licenses;
542 }
543
544 private void printAvailableLicenses() {
545 System.out.println("Apache-2.0 Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA");
546 System.out.println("CC-BY-NC-ND CC0 CDDL CPL Eiffel Expat GPL-2 GPL-3 LGPL-2 LGPL-2.1 LGPL-3");
547 System.out.println("GFDL-1.2 GFDL-1.3 GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
548 }
549
550 boolean recognizeLicense(Set licenses, String licenseName, String licenseUrl) {
551 boolean recognized = false;
552 licenseName = licenseName.toLowerCase();
553 licenseUrl = licenseUrl.toLowerCase();
554 if (licenseName.indexOf("mit ") >= 0 || licenseUrl.indexOf("mit-license") >= 0) {
555 licenses.add("MIT");
556 recognized = true;
557 } else if (licenseName.indexOf("bsd ") >= 0 || licenseUrl.indexOf("bsd-license") >= 0) {
558 licenses.add("BSD");
559 recognized = true;
560 } else if (licenseName.indexOf("artistic ") >= 0 || licenseUrl.indexOf("artistic-license") >= 0) {
561 licenses.add("Artistic");
562 recognized = true;
563 } else if (licenseName.indexOf("apache ") >= 0 || licenseUrl.indexOf("apache") >= 0) {
564 if (licenseName.indexOf("2.") >= 0 || licenseUrl.indexOf("2.") >= 0) {
565 licenses.add("Apache-2.0");
566 recognized = true;
567 } else if (licenseName.indexOf("1.0") >= 0 || licenseUrl.indexOf("1.0") >= 0) {
568 licenses.add("Apache-1.0");
569 recognized = true;
570 } else if (licenseName.indexOf("1.1") >= 0 || licenseUrl.indexOf("1.1") >= 0) {
571 licenses.add("Apache-1.1");
572 recognized = true;
573 }
574 } else if (licenseName.indexOf("lgpl ") >= 0 || licenseUrl.indexOf("lgpl") >= 0) {
575 if (licenseName.indexOf("2.1") >= 0 || licenseUrl.indexOf("2.1") >= 0) {
576 licenses.add("LGPL-2.1");
577 recognized = true;
578 } else if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
579 licenses.add("LGPL-2");
580 recognized = true;
581 } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
582 licenses.add("LGPL-2");
583 recognized = true;
584 }
585 } else if (licenseName.indexOf("gpl ") >= 0 || licenseUrl.indexOf("gpl") >= 0) {
586 if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
587 licenses.add("GPL-2");
588 recognized = true;
589 } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
590 licenses.add("GPL-3");
591 recognized = true;
592 }
593 }
594 return recognized;
523595 }
524596
525597 private void generateFile(VelocityContext context, String templateName, File destDir, String fileName) throws Exception {
574646 DependenciesSolver.executeProcess(new String[]{"chmod", "+x", file}, new DependenciesSolver.NoOutputHandler());
575647 }
576648
649 static class LicenseCheckResult implements DependenciesSolver.OutputHandler {
650
651 private Set licenses = new TreeSet();
652 private Set copyrightOwners = new TreeSet();
653
654 public void newLine(String line) {
655 if (line.startsWith(".") && line.indexOf(":") > 0) {
656 int col = line.lastIndexOf(":");
657 String license = line.substring(col + 1).trim();
658 if (license.indexOf("UNKNOWN") >= 0) {
659 return;
660 }
661 if (license.indexOf("*") >= 0) {
662 license = license.substring(license.lastIndexOf("*") + 1).trim();
663 }
664 licenses.add(license);
665 }
666 }
667
668 public Set getLicenses() {
669 return licenses;
670 }
671
672 public Set getCopyrightOwners() {
673 return copyrightOwners;
674 }
675 }
676
577677 interface DownloadType {
578678
579679 int UNKNOWN = 0;
0 /usr/share/java/ant-nodeps.jar
1 #foreach ($jar in $buildjars)
2 /usr/share/java/${jar}.jar
3 #end
00 build.directory=target
1 #if($generateJavadoc)
12 javadoc.dir=target/apidocs
3 javadoc.generate=true
4 #end
25 #if(!$runTests)
36 maven.test.skip=true
47 #end
0 <?xml version="1.0"?>
1
2 <project name="pkg-java" default="build-all" 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="clean-module">
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 #if ($containsJars)
19 <macrodef name="package-module">
20 <attribute name="dir"/>
21 <sequential>
22 <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
23 <property name="debian.dir" location="debian" />
24 <property name="project.dir" value="@{dir}" />
25 <property name="keep-cleaned-pom" value="true" />
26 </ant>
27 </sequential>
28 </macrodef>
29
30 #end
31 #if ($containsPlugins)
32 <macrodef name="package-plugin-module">
33 <attribute name="dir"/>
34 <sequential>
35 <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
36 <property name="debian.dir" location="debian" />
37 <property name="project.dir" value="@{dir}" />
38 <property name="maven.generate.target" value="plugin:descriptor" />
39 <property name="keep-cleaned-pom" value="true" />
40 <property name="use-local-repo" value="true" />
41 </ant>
42 </sequential>
43 </macrodef>
44
45 #end
46 <target name="clean">
47 <clean-module dir=""/>
48 #foreach ($module in $collectedProjects)
49 <clean-module dir="${module.artifactId}"/>
50 #end
51 </target>
52
53 <target name="package">
54 <package-module dir=""/>
55 #foreach ($module in $collectedProjects)
56 #if ($module.packaging == "maven-plugin")
57 <package-plugin-module dir="${module.artifactId}"/>
58 #else
59 <package-module dir="${module.artifactId}"/>
60 #end
61 #end
62 </target>
63
64 #if ($generateJavadoc)
65 <target name="javadoc">
66 <javadoc destdir="${javadoc.dir}">
67 #foreach ($module in $collectedProjects)
68 <packageset dir="${module.artifactId}/src/main/java/"/>
69 #end
70 </javadoc>
71 </target>
72
73 <target name="build-all" depends="package, javadoc" />
74 #else
75 <target name="build-all" depends="package" />
76 #end
77
78 </project>
1717 Priority: optional
1818 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
1919 Uploaders: ${packager} <${packagerEmail}>
20 Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant-optional, maven-ant-helper (>> 6.7)
21 Build-Depends-Indep: maven-repo-helper (>= 1.4),
22 #printDependencies($compileDependencies)$space
20 Build-Depends: debhelper (>= 7), default-jdk, maven-repo-helper (>= 1.4)#if ($project.packaging != "pom" || $project.modules.size() > 0), ant-optional, maven-ant-helper (>> 6.7)#end$space
21 #if(!$compileDependencies.isEmpty())
22 Build-Depends-Indep:#printDependencies($compileDependencies)$space
23 #end
2324 Standards-Version: 3.9.1
2425 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
2526 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
2930 Package: ${binPackage}
3031 Architecture: all
3132 ## libraries should not depend on runtime - default-jre-headless | java2-runtime-headless,
32 Depends: ${dollar}{misc:Depends},
33 #printDependencies($runtimeDependencies)
33 Depends: ${dollar}{misc:Depends},#printDependencies($runtimeDependencies)$space
3434 #if(!$optionalDependencies.isEmpty())
3535 Recommends: #printDependencies($optionalDependencies)
36 #end
37 #if ($generateJavadoc)
38 Suggests: ${binPackage}-doc
3639 #end
3740 Description: ${project.Name}
3841 #if ($description.isEmpty()) TODO - fill the description
5053 Package: ${binPackage}-doc
5154 Architecture: all
5255 Section: doc
53 Depends: ${dollar}{misc:Depends}, ${dollar}{maven:DocDepends}
54 Recommends: ${dollar}{maven:DocOptionalDepends}
56 Depends: ${dollar}{misc:Depends}, $printDependencies($javadocDependencies)$space
57 #if(!$javadocOptionalDependencies.isEmpty())
58 Recommends: #printDependencies($javadocOptionalDependencies)
59 #end
5560 Suggests: ${binPackage}
5661 Description: Documentation for ${project.Name}
5762 #if ($description.isEmpty()) TODO - fill the description
1818 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
1919 Uploaders: ${packager} <${packagerEmail}>
2020 Build-Depends: debhelper (>= 7), cdbs, default-jdk, maven-debian-helper (>= 1.3)
21 #if(!$compileDependencies.isEmpty())
2122 Build-Depends-Indep:#printDependencies($compileDependencies)$space
23 #end
2224 Standards-Version: 3.9.1
2325 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
2426 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
3032 ## libraries should not depend on runtime - default-jre-headless | java2-runtime-headless,
3133 Depends: ${dollar}{misc:Depends}, ${dollar}{maven:Depends}
3234 Recommends: ${dollar}{maven:OptionalDepends}
35 #if ($generateJavadoc)
36 Suggests: ${binPackage}-doc
37 #end
3338 Description: ${project.Name}
3439 #if ($description.isEmpty()) TODO - fill the description
3540 #else
11 Format-Specification: http://dep.debian.net/deps/dep5/
22 Name: ${project.Name}
33 #set ($maintainerHeader = "Maintainer: ")
4 #foreach ($developer in $project.Developers)
5 ${maintainerHeader} ${developer.Name} #if (${developer.Email})<${developer.Email}> as developer
6 #set ($maintainerHeader = " ")
7 #else $space
4 #macro(printRoles $roles $defaultRole)
5 #if ($roles.isEmpty())${defaultRole}
6 #else
7 #foreach ($role in $roles)
8 ${role}#if($velocityHasNext), #end
89 #end
910 #end
11 #end
12 #foreach ($developer in $project.Developers)
13 ${maintainerHeader} ${developer.Name}#if (${developer.Email}) <${developer.Email}>#end as #printRoles($developer.Roles, "Developer")$space
14 #set ($maintainerHeader = " ")
15 #end
1016 #foreach ($contributor in $project.Contributors)
11 ${maintainerHeader} ${contributor.Name} #if (${contributor.Email})<${contributor.Email}> as contributor
12 #set ($maintainerHeader = " ")
13 #else $space
14 #end
17 ${maintainerHeader} ${contributor.Name}#if (${contributor.Email}) <${contributor.Email}>#end as #printRoles($developer.Roles, "Contributor")$space
18 #set ($maintainerHeader = " ")
1519 #end
1620 Source: ${project.Url}
1721
1822 Files: *
1923 Copyright: ${copyrightYear}, ${copyrightOwner}
2024 License: #foreach($license in $licenses)${license}#if($velocityHasNext) or #end#end
25
2126
2227 Files: debian/*
2328 Copyright: ${currentYear}, ${packager} <${packagerEmail}>
2631
2732 #foreach ($license in $licenses)
2833 License: $license
34 #set ($knownLicenses = ["Apache-2.0", "BSD", "GFDL-1.2", "GPL-2", "LGPL-2.1", "Artistic", "GPL-3", "LGPL-2", "LGPL-3"])
2935 #if ($knownLicenses.contains($license))
3036 On Debian GNU/Linux system you can find the complete text of the
3137 $license license in '/usr/share/common-licenses/$license'
3238 #else
33 TODO: include the full license text here
39 TODO: include the full text of the license here
3440 #end
3541
3642 #end
00 #!/usr/bin/make -f
11
2 include /usr/share/cdbs/1/rules/debhelper.mk
3 include /usr/share/cdbs/1/class/ant.mk
4 #set ($space=' ')
5 #macro(printJars $jars)
6 #set ($lineLength=0)
7 #foreach ($jar in $jars)
8 #if($lineLength==0)${space}#end${jar}#if($velocityHasNext)${space}#end
9 #set ($lineLength = $lineLength + $jar.length() + 2)
10 #if ($lineLength > 70)
11 ${space}\
12 #set ($lineLength=0)
2 DEB_SOURCE_PACKAGE := $(shell dpkg-parsechangelog | grep '^Source:' | cut -f 2 -d ' ')
3 DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d: -f2- | sed 's/-[^-]*$$//')
4
5 #if ($project.packaging != "pom" || $project.modules.size() > 0)
6 export JAVA_HOME=/usr/lib/jvm/default-java
7 export CLASSPATH=$(shell for jar in `cat debian/build-classpath`; do if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; done)
8 #if ($project.packaging == "pom" && $project.modules.size() > 0)
9 export ANT_ARGS=-Dbasedir=$(realpath .) -Dpackage=$(DEB_SOURCE_PACKAGE) -f debian/build.xml
10 #else
11 export ANT_ARGS=-Dbasedir=$(realpath .) -Dpackage=$(DEB_SOURCE_PACKAGE) -f /usr/share/maven-ant-helper/maven-build.xml
1312 #end
14 #end
15 #end
16
17 JAVA_HOME := /usr/lib/jvm/default-java
18 DEB_JARS := ant-nodeps #if (!$buildJars.isEmpty()) #printJars($buildJars)#end $space
19 DEB_ANT_BUILDFILE := /usr/share/maven-ant-helper/maven-build.xml
20 DEB_ANT_ARGS := -Dbasedir=$(realpath .) -Dpackage=$(PACKAGE)
2113 #if ($generateJavadoc)
2214 DEB_ANT_BUILD_TARGET := package javadoc
2315 API_DOCS := target/docs/api
2416 #end
2517
26 get-orig-source:
27 uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
28
29 binary-post-install/$binPackage::
30 mh_install -p$binPackage
18 #end
19 %:
20 #if ($project.packaging == "pom" && $project.modules.size() == 0)
21 dh $@ --with maven_repo_helper
22 #else
23 dh $@ --buildsystem=ant --with maven_repo_helper
24 #end
3125
3226 #if ($generateJavadoc)
3327 binary-post-install/$binPackage-doc::
3428 dh_install -p$binPackage-doc $(API_DOCS) usr/share/doc/$binPackage
3529
3630 #end
37 clean::
38 -mh_clean
39
31 get-orig-source:
32 uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
0 package org.debian.maven.packager;
1
02 /*
1 * To change this template, choose Tools | Templates
2 * and open the template in the editor.
3 * Copyright 2009 Ludovic Claude.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * 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, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
316 */
4
5 package org.debian.maven.packager;
617
718 import java.io.File;
819 import java.io.FileReader;
2536 import org.debian.maven.repo.ListOfPOMs;
2637 import org.debian.maven.repo.Repository;
2738
28 /**
29 *
30 * @author ludo
31 */
3239 public class DependenciesSolverTest extends TestCase {
3340
3441 private File testDir = new File("tmp");
179186 }
180187
181188 public void testSolveOpenMRSApiDependencies() throws Exception {
182 useFile("openmrs/pom.xml", pomFile);
189 useFile("openmrs/api/pom.xml", pomFile);
183190 DependenciesSolver solver = new DependenciesSolver();
184191 solver.setMavenRepo(getFileInClasspath("repository/root.dir").getParentFile());
185192 solver.setOutputDirectory(testDir);
201208 assertTrue("Did not expect any issues", solver.getIssues().isEmpty());
202209
203210 solver.setBaseDir(testDir);
204 solver.setListOfPoms(new File(testDir, "openmrs.poms"));
205
206 solver.saveListOfPoms();
207 solver.saveMavenRules();
208 solver.saveSubstvars();
209
210 assertFileEquals("openmrs.poms", "openmrs.poms");
211 assertFileEquals("openmrs.substvars", "openmrs.substvars");
212 assertFileEquals("openmrs.rules", "maven.rules");
211 solver.setListOfPoms(new File(testDir, "openmrs-api.poms"));
212
213 solver.saveListOfPoms();
214 solver.saveMavenRules();
215 solver.saveSubstvars();
216
217 assertFileEquals("openmrs-api.poms", "openmrs-api.poms");
218 assertFileEquals("openmrs-api.substvars", "openmrs.substvars");
219 assertFileEquals("openmrs-api.rules", "maven.rules");
213220 }
214221
215222 protected void assertFileEquals(String resource, String fileName) throws Exception {
0 package org.debian.maven.packager;
1
2 import junit.framework.TestCase;
3
4 import java.util.HashSet;
5 import java.util.Set;
6
7 /**
8 * Created by IntelliJ IDEA.
9 * User: ludo
10 * Date: Nov 18, 2010
11 * Time: 11:56:33 PM
12 * To change this template use File | Settings | File Templates.
13 */
14 public class GenerateDebianFilesMojoTest extends TestCase {
15
16 public void testRecognizeLicense() throws Exception {
17 GenerateDebianFilesMojo mojo = new GenerateDebianFilesMojo();
18
19 Set licenses = new HashSet();
20 assertTrue(mojo.recognizeLicense(licenses, "Apache (v2.0)", ""));
21 assertEquals("Apache-2.0", licenses.iterator().next());
22 licenses.clear();
23
24 assertTrue(mojo.recognizeLicense(licenses, "", "http://www.apache.org/licenses/LICENSE-2.0"));
25 assertEquals("Apache-2.0", licenses.iterator().next());
26 licenses.clear();
27
28 }
29 }
00 #List of dependencies for libplexus-active-collections-java, generated for use by debian/control
11 #Wed Jun 24 22:57:35 BST 2009
2 maven.CompileDepends=libplexus-maven-plugin-java (>\= 1.3), libsurefire-java
2 maven.CompileDepends=libplexus-maven-plugin-java (>\= 1.3.8), libsurefire-java
33 maven.Depends=libplexus-component-api-java, libplexus-containers-java
44 maven.OptionalDepends=
55 maven.TestDepends=junit (>\= 3.8.1)
0 #List of dependencies for openmrs, generated for use by debian/control
1 #Sun Oct 24 23:51:45 CEST 2010
2 maven.CompileDepends=libmaven-javadoc-plugin-java
3 maven.Depends=junit4
4 maven.OptionalDepends=
5 maven.TestDepends=
00 #!/bin/sh
1
2 # Copyright 2009 Torsten Werner.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
115
216 set -e
317