This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository maven-debian-helper.
commit 249547da77a24be3d05a9ab0938c00eafb324e53 Author: Emmanuel Bourg <[email protected]> Date: Thu Jun 30 10:52:08 2016 +0200 Added pom relocation support --- .../org/debian/maven/plugin/SysInstallMojo.java | 41 ++++++++++++++++++++++ debian/changelog | 8 +++++ debian/control | 4 +-- pom.xml | 2 +- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java b/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java index 3ba4a42..9c18572 100644 --- a/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java +++ b/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java @@ -16,6 +16,7 @@ package org.debian.maven.plugin; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -27,6 +28,8 @@ import java.util.regex.Pattern; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.io.RawInputStreamFacade; +import org.debian.maven.repo.Dependency; import org.debian.maven.repo.ListOfPOMs; import org.debian.maven.repo.POMCleaner; import org.debian.maven.repo.POMOptions; @@ -197,6 +200,10 @@ public class SysInstallMojo extends AbstractMojo { private String classifier; + /** + * The Maven artifacts relocated to this artifact. + */ + private List<Dependency> relocatedArtifacts; // ---------------------------------------------------------------------- // Public methods @@ -717,6 +724,8 @@ public class SysInstallMojo extends AbstractMojo { // creation installToUsj = pomOption.isJavaLib() || (packageIsJavaLib && installToUsj); + + relocatedArtifacts = pomOption.getRelocatedArtifacts(); } List<String> params = new ArrayList<String>(); @@ -786,6 +795,37 @@ public class SysInstallMojo extends AbstractMojo { } /** + * Install the relocated poms + */ + protected void relocatePoms() throws IOException { + for (Dependency relocated : relocatedArtifacts) { + getLog().info("Relocating " + relocated.formatCompactNotation()); + + File relocatedPath = new File(packagePath() + "/usr/share/maven-repo" + artifactPath(relocated.getGroupId(), relocated.getArtifactId(), relocated.getVersion())); + File relocatedPom = new File(relocatedPath, pomName(relocated.getArtifactId(), relocated.getVersion())); + String pom = createRelocationPom(relocated); + + FileUtils.copyStreamToFile(new RawInputStreamFacade(new ByteArrayInputStream(pom.getBytes("UTF-8"))), relocatedPom); + } + } + + private String createRelocationPom(Dependency relocateArtifact) { + return "<project>\n" + + " <modelVersion>4.0.0</modelVersion>\n" + + " <groupId>" + relocateArtifact.getGroupId() + "</groupId>\n" + + " <artifactId>" + relocateArtifact.getArtifactId() + "</artifactId>\n" + + " <version>" + relocateArtifact.getVersion() + "</version>\n" + + " <distributionManagement>\n" + + " <relocation>\n" + + " <groupId>" + destGroupId + "</groupId>\n" + + " <artifactId>" + destArtifactId + "</artifactId>\n" + + " <version>" + debianVersion + "</version>\n" + + " </relocation>\n" + + " </distributionManagement>\n" + + "</project>"; + } + + /** * Prepare the destination directories: remove the directory symlinks that were created * by copy-repo.sh if they exist as they point to a directory owned by root and that cannot * be modified. @@ -803,6 +843,7 @@ public class SysInstallMojo extends AbstractMojo { cleanPom(); prepareDestDirs(); copyPom(); + relocatePoms(); if (installToUsj) { copyJarToUsj(); symlinkJar(); diff --git a/debian/changelog b/debian/changelog index a57bc25..939be14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +maven-debian-helper (2.1) UNRELEASED; urgency=medium + + * Team upload. + * Added pom relocation support + * Depend on maven-repo-helper >= 1.9 + + -- Emmanuel Bourg <[email protected]> Thu, 30 Jun 2016 10:30:52 +0200 + maven-debian-helper (2.0.7) unstable; urgency=medium * Team upload. diff --git a/debian/control b/debian/control index f8eab77..7028ab9 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends-Indep: junit4, libmaven3-core-java, libmaven-plugin-tools-java, libplexus-velocity-java, - maven-repo-helper (>= 1.8.9) + maven-repo-helper (>= 1.9) Standards-Version: 3.9.8 Vcs-Git: https://anonscm.debian.org/git/pkg-java/maven-debian-helper.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/maven-debian-helper.git @@ -22,7 +22,7 @@ Homepage: http://wiki.debian.org/Java/MavenBuilder Package: maven-debian-helper Architecture: all -Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.8.9), maven (>= 3.3), +Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.9), maven (>= 3.3), libmaven-clean-plugin-java, libmaven-compiler-plugin-java, libmaven-jar-plugin-java, diff --git a/pom.xml b/pom.xml index 86e3b1d..7d6094d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <dependency> <groupId>org.debian.maven</groupId> <artifactId>maven-repo-helper</artifactId> - <version>[1.8,2.0)</version> + <version>[1.9,2.0)</version> </dependency> <dependency> <groupId>org.apache.maven</groupId> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

