[Git][java-team/maven-debian-helper][master] 13 commits: Removed PlexusUtilsInjector, obsolete since Maven 3.9
Emmanuel Bourg (@ebourg)
gitlab at salsa.debian.org
Sat Oct 24 08:58:46 BST 2026
Emmanuel Bourg pushed to branch master at Debian Java Maintainers / maven-debian-helper
Commits:
8a73caef by Emmanuel Bourg at 2026-10-24T00:11:56+02:00
Removed PlexusUtilsInjector, obsolete since Maven 3.9
- - - - -
a5f6793c by Emmanuel Bourg at 2026-10-24T00:25:06+02:00
Automatically relocate the Maven plugins to the version installed
- - - - -
92a9549f by Emmanuel Bourg at 2026-10-24T00:27:29+02:00
Standards-Version updated to 4.7.4
- - - - -
18020c33 by Emmanuel Bourg at 2026-10-24T00:27:56+02:00
Removed the Priority field
- - - - -
bcd64f4f by Emmanuel Bourg at 2026-10-24T00:44:09+02:00
Move to version 2.7
- - - - -
3dbe644a by Emmanuel Bourg at 2026-10-24T00:47:23+02:00
The generated control file now specifies Standards-Version: 4.7.4
- - - - -
30c23a62 by Emmanuel Bourg at 2026-10-24T00:48:07+02:00
No longer generate the "Priority: optional" field
- - - - -
50aa2b45 by Emmanuel Bourg at 2026-10-24T00:55:55+02:00
Added com.github.siom79.japicmp:japicmp-maven-plugin to the ignored plugins
- - - - -
94830e7c by Emmanuel Bourg at 2026-10-24T00:55:55+02:00
Added org.cyclonedx:cyclonedx-maven-plugin to the ignored plugins
- - - - -
c7d5e1e9 by Emmanuel Bourg at 2026-10-24T00:55:55+02:00
Added org.sonatype.central:central-publishing-maven-plugin to the ignored plugins
- - - - -
9895bc1e by Emmanuel Bourg at 2026-10-24T01:02:01+02:00
Added com.mycila:license-maven-plugin to the ignored plugins
- - - - -
c24cbc2e by Emmanuel Bourg at 2026-10-24T01:02:01+02:00
Added maven-plugin-report-plugin to the documentation plugins
- - - - -
cbaa6a8a by Emmanuel Bourg at 2026-10-24T09:54:37+02:00
Upload to unstable
- - - - -
17 changed files:
- debian-maven-plugin/pom.xml
- debian/changelog
- debian/control
- debian/copyright
- debian/rules
- maven-debian-helper/pom.xml
- − maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
- + maven-debian-helper/src/main/java/org/debian/maven/ArtifactDirectory.java
- + maven-debian-helper/src/main/java/org/debian/maven/DebianWorkspaceReader.java
- + maven-debian-helper/src/main/resources/META-INF/sisu/javax.inject.Named
- + maven-debian-helper/src/test/java/org/debian/maven/ArtifactDirectoryTest.java
- + maven-debian-helper/src/test/java/org/debian/maven/DebianWorkspaceReaderTest.java
- + maven-debian-helper/src/test/java/org/debian/maven/TestRepository.java
- maven-packager-utils/pom.xml
- maven-packager-utils/src/main/java/org/debian/maven/packager/util/IgnoreDependencyQuestions.java
- maven-packager-utils/src/main/resources/control.vm
- pom.xml
Changes:
=====================================
debian-maven-plugin/pom.xml
=====================================
@@ -6,7 +6,7 @@
<parent>
<artifactId>maven-debian</artifactId>
<groupId>org.debian.maven</groupId>
- <version>2.6</version>
+ <version>2.7</version>
</parent>
<artifactId>debian-maven-plugin</artifactId>
=====================================
debian/changelog
=====================================
@@ -1,3 +1,20 @@
+maven-debian-helper (2.7) unstable; urgency=medium
+
+ * Automatically relocate the Maven plugins to the version installed
+ * Removed PlexusUtilsInjector, obsolete since Maven 3.9
+ * Standards-Version updated to 4.7.4
+ * The generated control file now specifies Standards-Version: 4.7.4
+ * Removed the Priority field
+ * No longer generate the "Priority: optional" field
+ * Added com.github.siom79.japicmp:japicmp-maven-plugin to the ignored plugins
+ * Added org.cyclonedx:cyclonedx-maven-plugin to the ignored plugins
+ * Added org.sonatype.central:central-publishing-maven-plugin to the ignored
+ plugins
+ * Added com.mycila:license-maven-plugin to the ignored plugins
+ * Added maven-plugin-report-plugin to the documentation plugins
+
+ -- Emmanuel Bourg <ebourg at apache.org> Sat, 24 Oct 2026 09:54:32 +0200
+
maven-debian-helper (2.6.9) unstable; urgency=medium
* Team upload.
=====================================
debian/control
=====================================
@@ -1,6 +1,5 @@
Source: maven-debian-helper
Section: java
-Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders:
Torsten Werner <twerner at debian.org>,
@@ -19,7 +18,7 @@ Build-Depends:
libplexus-velocity-java,
maven-ant-helper (>= 8.9~),
maven-repo-helper (>= 1.10~)
-Standards-Version: 4.7.2
+Standards-Version: 4.7.4
Vcs-Git: https://salsa.debian.org/java-team/maven-debian-helper.git
Vcs-Browser: https://salsa.debian.org/java-team/maven-debian-helper
Homepage: https://wiki.debian.org/Java/MavenBuilder
@@ -36,7 +35,7 @@ Depends:
libplexus-velocity-java,
libsurefire-java,
libxml2-utils,
- maven (>= 3.3),
+ maven (>= 3.9),
maven-repo-helper (>= 1.10~),
unzip,
velocity,
=====================================
debian/copyright
=====================================
@@ -16,11 +16,6 @@ Copyright: 2008-2009, Torsten Werner <twerner at debian.org>
2023, Jochen Sprickerhof <jspricke at debian.org>
License: Apache-2.0
-Files: maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
-Copyright: 2010-2012, The Apache Software Foundation
-License: Apache-2.0
-Comment: Copied and modified from Apache Maven
-
License: Apache-2.0
On Debian systems, the full text of the Apache-2.0 license
can be found in the file '/usr/share/common-licenses/Apache-2.0'
=====================================
debian/rules
=====================================
@@ -2,7 +2,8 @@
include /usr/share/dpkg/pkg-info.mk
-export CLASSPATH=/usr/share/java/commons-io.jar\
+export CLASSPATH=/usr/share/java/atinject-jsr330-api.jar\
+ :/usr/share/java/commons-io.jar\
:/usr/share/java/maven-artifact-3.x.jar\
:/usr/share/java/maven-core-3.x.jar\
:/usr/share/java/maven-embedder-3.x.jar\
=====================================
maven-debian-helper/pom.xml
=====================================
@@ -5,7 +5,7 @@
<parent>
<groupId>org.debian.maven</groupId>
<artifactId>maven-debian</artifactId>
- <version>2.6</version>
+ <version>2.7</version>
</parent>
<artifactId>maven-debian-helper</artifactId>
@@ -21,5 +21,9 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
</dependencies>
</project>
=====================================
maven-debian-helper/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java deleted
=====================================
@@ -1,91 +0,0 @@
-package org.apache.maven.plugin.internal;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.collection.DependencyGraphTransformationContext;
-import org.eclipse.aether.collection.DependencyGraphTransformer;
-import org.eclipse.aether.graph.DefaultDependencyNode;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.util.artifact.JavaScopes;
-
-/**
- * Injects plexus-utils:1.1 into a plugin's class path if it doesn't already declare a dependency on plexus-utils. This
- * is another legacy bit to provide backward-compat with Maven 2.x.
- *
- * This class was copied from Maven and modified to use plexus-utils 2.x instead of 1.1.
- * It overrides the same class defined by Maven since maven-debian-helper.jar is loaded first
- * (this is ensured by the order of the load directives in /etc/maven/m2-debian.conf).
- *
- * @author Benjamin Bentmann
- */
-class PlexusUtilsInjector
- implements DependencyGraphTransformer
-{
-
- private static final String GID = "org.codehaus.plexus";
-
- private static final String AID = "plexus-utils";
-
- private static final String VER = "2.x";
-
- private static final String EXT = "jar";
-
- public DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
- throws RepositoryException
- {
- if ( findPlexusUtils( node ) == null )
- {
- Artifact pu = new DefaultArtifact( GID, AID, null, EXT, VER );
- DefaultDependencyNode child = new DefaultDependencyNode( new Dependency( pu, JavaScopes.RUNTIME ) );
- child.setRepositories( node.getRepositories() );
- child.setRequestContext( node.getRequestContext() );
- node.getChildren().add( child );
- }
-
- return node;
- }
-
- private DependencyNode findPlexusUtils( DependencyNode node )
- {
- Artifact artifact = node.getDependency().getArtifact();
-
- if ( AID.equals( artifact.getArtifactId() ) && GID.equals( artifact.getGroupId() )
- && EXT.equals( artifact.getExtension() ) && "".equals( artifact.getClassifier() ) )
- {
- return node;
- }
-
- for ( DependencyNode child : node.getChildren() )
- {
- DependencyNode result = findPlexusUtils( child );
- if ( result != null )
- {
- return result;
- }
- }
-
- return null;
- }
-
-}
=====================================
maven-debian-helper/src/main/java/org/debian/maven/ArtifactDirectory.java
=====================================
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2026 Emmanuel Bourg.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.maven;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.artifact.versioning.ComparableVersion;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+
+/**
+ * The directory of an artifact in the local repository, containing the versions installed.
+ */
+class ArtifactDirectory {
+
+ private final String artifactId;
+
+ private final File directory;
+
+ /** The versions installed with a POM, initialized on the first use */
+ private List<String> versions;
+
+ ArtifactDirectory(File localRepository, String groupId, String artifactId) {
+ this.artifactId = artifactId;
+ this.directory = new File(localRepository, groupId.replace('.', '/') + "/" + artifactId);
+ }
+
+ public File getFile() {
+ return directory;
+ }
+
+ /**
+ * Tells if a version of the artifact is installed.
+ */
+ public boolean exists() {
+ return directory.isDirectory();
+ }
+
+ /**
+ * Tells if the specified version is installed.
+ */
+ public boolean hasVersion(String version) {
+ return new File(directory, version).exists();
+ }
+
+ /**
+ * Returns the POM of the specified version in the local repository.
+ */
+ public File getPom(String version) {
+ return new File(directory, version + "/" + artifactId + "-" + version + ".pom");
+ }
+
+ /**
+ * Returns the versions installed with a POM.
+ */
+ public List<String> getVersions() {
+ if (versions == null) {
+ versions = new ArrayList<>();
+ File[] versionDirs = directory.listFiles(File::isDirectory);
+ if (versionDirs != null) {
+ for (File versionDir : versionDirs) {
+ if (getPom(versionDir.getName()).isFile()) {
+ versions.add(versionDir.getName());
+ }
+ }
+ }
+ }
+ return versions;
+ }
+
+ /**
+ * Returns the most recent version installed.
+ */
+ public String getLatestVersion() {
+ String latestVersion = null;
+ for (String version : getVersions()) {
+ if (latestVersion == null || new ComparableVersion(version).compareTo(new ComparableVersion(latestVersion)) > 0) {
+ latestVersion = version;
+ }
+ }
+ return latestVersion;
+ }
+
+ /**
+ * Tells if one of the versions installed is a Maven plugin.
+ */
+ public boolean isPlugin() {
+ for (String version : getVersions()) {
+ Model model = readModel(getPom(version));
+ if (model != null && "maven-plugin".equals(model.getPackaging())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Model readModel(File pom) {
+ try (Reader reader = new FileReader(pom)) {
+ return new MavenXpp3Reader().read(reader, false);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
=====================================
maven-debian-helper/src/main/java/org/debian/maven/DebianWorkspaceReader.java
=====================================
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2026 Emmanuel Bourg.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.maven;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Collections;
+import java.util.List;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * Workspace reader adjusting the resolution of the artifacts in a Debian build.
+ *
+ * Maven looks up a single reader under the name "ide", it's only available
+ * in Debian builds through the load directives in /etc/maven/m2-debian.conf.
+ *
+ * When the build requests a version of a plugin that isn't installed, the POM
+ * of the requested version is replaced by a relocation to the most recent
+ * version installed.
+ */
+ at Named("ide")
+ at Singleton
+public class DebianWorkspaceReader implements WorkspaceReader {
+
+ private final WorkspaceRepository repository = new WorkspaceRepository("debian");
+
+ /** The local repository, set to debian/maven-repo by maven-debian-helper */
+ private final File localRepository;
+
+ public DebianWorkspaceReader() {
+ this(new File(System.getProperty("maven.repo.local")));
+ }
+
+ DebianWorkspaceReader(File localRepository) {
+ this.localRepository = localRepository;
+ }
+
+ @Override
+ public WorkspaceRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public File findArtifact(Artifact artifact) {
+ ArtifactDirectory directory = new ArtifactDirectory(localRepository, artifact.getGroupId(), artifact.getArtifactId());
+ if (isPom(artifact) && directory.exists() && !directory.hasVersion(artifact.getVersion()) && directory.isPlugin()) {
+ try {
+ File pom = directory.getPom(artifact.getVersion());
+ writeRelocation(artifact, pom, directory.getLatestVersion());
+ return pom;
+ } catch (IOException e) {
+ throw new IllegalStateException("Unable to create the relocation POM for " + artifact, e);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<String> findVersions(Artifact artifact) {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Tells if the artifact is a POM.
+ */
+ private boolean isPom(Artifact artifact) {
+ return "pom".equals(artifact.getExtension()) && artifact.getClassifier().isEmpty();
+ }
+
+ /**
+ * Writes the POM relocating the artifact to the specified version.
+ */
+ private void writeRelocation(Artifact artifact, File pom, String version) throws IOException {
+ Relocation relocation = new Relocation();
+ relocation.setVersion(version);
+
+ DistributionManagement distributionManagement = new DistributionManagement();
+ distributionManagement.setRelocation(relocation);
+
+ Model model = new Model();
+ model.setModelVersion("4.0.0");
+ model.setGroupId(artifact.getGroupId());
+ model.setArtifactId(artifact.getArtifactId());
+ model.setVersion(artifact.getVersion());
+ model.setPackaging("pom");
+ model.setDistributionManagement(distributionManagement);
+
+ pom.getParentFile().mkdirs();
+ try (Writer writer = Files.newBufferedWriter(pom.toPath(), StandardCharsets.UTF_8)) {
+ new MavenXpp3Writer().write(writer, model);
+ }
+ }
+}
=====================================
maven-debian-helper/src/main/resources/META-INF/sisu/javax.inject.Named
=====================================
@@ -0,0 +1 @@
+org.debian.maven.DebianWorkspaceReader
=====================================
maven-debian-helper/src/test/java/org/debian/maven/ArtifactDirectoryTest.java
=====================================
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2026 Emmanuel Bourg.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.maven;
+
+import static org.debian.maven.TestRepository.install;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class ArtifactDirectoryTest {
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ private File repository;
+
+ @Before
+ public void setUp() throws Exception {
+ repository = folder.getRoot();
+ install(repository, "org.apache.maven.plugins", "maven-compiler-plugin", "3.9.0", "maven-plugin");
+ install(repository, "org.apache.maven.plugins", "maven-compiler-plugin", "3.13.0", "maven-plugin");
+ install(repository, "org.apache.maven.plugins", "maven-compiler-plugin", "3.2", "jar");
+ install(repository, "org.apache.maven.plugins", "maven-surefire-plugin", "2.22.3", "maven-plugin");
+ install(repository, "org.apache.maven.plugins", "maven-surefire-plugin", "3.5.4", "jar");
+ install(repository, "org.codehaus.plexus", "plexus-utils", "3.6.1", "jar");
+ new File(repository, "org/codehaus/plexus/plexus-utils/4.0.2").mkdirs();
+ }
+
+ private ArtifactDirectory directory(String groupId, String artifactId) {
+ return new ArtifactDirectory(repository, groupId, artifactId);
+ }
+
+ @Test
+ public void testFile() {
+ File expected = new File(repository, "org/apache/maven/plugins/maven-compiler-plugin");
+ File file = directory("org.apache.maven.plugins", "maven-compiler-plugin").getFile();
+ assertEquals(expected, file);
+ }
+
+ @Test
+ public void testExists() {
+ assertTrue(directory("org.apache.maven.plugins", "maven-compiler-plugin").exists());
+ assertFalse("unknown artifact", directory("org.apache.maven.plugins", "maven-foo-plugin").exists());
+ }
+
+ @Test
+ public void testPom() {
+ File expected = new File(repository, "org/apache/maven/plugins/maven-compiler-plugin/3.13.0/maven-compiler-plugin-3.13.0.pom");
+ File pom = directory("org.apache.maven.plugins", "maven-compiler-plugin").getPom("3.13.0");
+ assertEquals(expected, pom);
+ }
+
+ @Test
+ public void testHasVersion() {
+ ArtifactDirectory directory = directory("org.apache.maven.plugins", "maven-compiler-plugin");
+ assertTrue("installed version", directory.hasVersion("3.13.0"));
+ assertTrue("relocated version", directory.hasVersion("3.2"));
+ assertFalse("missing version", directory.hasVersion("3.15.0"));
+ assertFalse("unknown artifact", directory("org.apache.maven.plugins", "maven-foo-plugin").hasVersion("1.0"));
+ }
+
+ @Test
+ public void testVersions() {
+ assertEquals(Arrays.asList("3.13.0", "3.2", "3.9.0"), sorted(directory("org.apache.maven.plugins", "maven-compiler-plugin").getVersions()));
+ assertEquals("version without POM", Collections.singletonList("3.6.1"), directory("org.codehaus.plexus", "plexus-utils").getVersions());
+ assertEquals("unknown artifact", Collections.emptyList(), directory("org.apache.maven.plugins", "maven-foo-plugin").getVersions());
+ }
+
+ @Test
+ public void testLatestVersion() {
+ assertEquals("version ordering", "3.13.0", directory("org.apache.maven.plugins", "maven-compiler-plugin").getLatestVersion());
+ assertEquals("relocation", "3.5.4", directory("org.apache.maven.plugins", "maven-surefire-plugin").getLatestVersion());
+ assertNull("unknown artifact", directory("org.apache.maven.plugins", "maven-foo-plugin").getLatestVersion());
+ }
+
+ @Test
+ public void testPlugin() {
+ assertTrue(directory("org.apache.maven.plugins", "maven-compiler-plugin").isPlugin());
+ assertFalse("not a plugin", directory("org.codehaus.plexus", "plexus-utils").isPlugin());
+ assertFalse("unknown artifact", directory("org.apache.maven.plugins", "maven-foo-plugin").isPlugin());
+ }
+
+ private static List<String> sorted(List<String> list) {
+ List<String> copy = new ArrayList<>(list);
+ Collections.sort(copy);
+ return copy;
+ }
+}
=====================================
maven-debian-helper/src/test/java/org/debian/maven/DebianWorkspaceReaderTest.java
=====================================
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2026 Emmanuel Bourg.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.maven;
+
+import static org.debian.maven.TestRepository.install;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class DebianWorkspaceReaderTest {
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder();
+
+ private DebianWorkspaceReader reader;
+
+ @Before
+ public void setUp() throws Exception {
+ File repository = folder.getRoot();
+ install(repository, "org.apache.maven.plugins", "maven-compiler-plugin", "3.13.0", "maven-plugin");
+ install(repository, "org.apache.maven.plugins", "maven-compiler-plugin", "3.2", "jar");
+ install(repository, "org.codehaus.plexus", "plexus-utils", "3.6.1", "jar");
+
+ reader = new DebianWorkspaceReader(repository);
+ }
+
+ private Model read(File pom) throws Exception {
+ try (Reader in = new FileReader(pom)) {
+ return new MavenXpp3Reader().read(in);
+ }
+ }
+
+ @Test
+ public void testMissingPluginVersion() throws Exception {
+ File pom = reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:pom:3.15.0"));
+ assertNotNull("relocation POM", pom);
+ File expected = new File(folder.getRoot(), "org/apache/maven/plugins/maven-compiler-plugin/3.15.0/maven-compiler-plugin-3.15.0.pom");
+ assertEquals("relocation POM", expected, pom);
+
+ Model model = read(pom);
+ assertEquals("groupId", "org.apache.maven.plugins", model.getGroupId());
+ assertEquals("artifactId", "maven-compiler-plugin", model.getArtifactId());
+ assertEquals("version", "3.15.0", model.getVersion());
+
+ Relocation relocation = model.getDistributionManagement().getRelocation();
+ assertNotNull("relocation", relocation);
+ assertNull("relocated groupId", relocation.getGroupId());
+ assertNull("relocated artifactId", relocation.getArtifactId());
+ assertEquals("relocated version", "3.13.0", relocation.getVersion());
+ }
+
+ @Test
+ public void testRelocationInstalled() {
+ assertNotNull(reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:pom:3.15.0")));
+ assertNull("relocation already installed", reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:pom:3.15.0")));
+ }
+
+ @Test
+ public void testNotRelocated() {
+ assertNull("jar", reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:jar:3.15.0")));
+ assertNull("classifier", reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:pom:sources:3.15.0")));
+ assertNull("installed version", reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-compiler-plugin:pom:3.13.0")));
+ assertNull("unknown artifact", reader.findArtifact(new DefaultArtifact("org.apache.maven.plugins:maven-foo-plugin:pom:1.0")));
+ assertNull("not a plugin", reader.findArtifact(new DefaultArtifact("org.codehaus.plexus:plexus-utils:pom:4.0.2")));
+ }
+}
=====================================
maven-debian-helper/src/test/java/org/debian/maven/TestRepository.java
=====================================
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2026 Emmanuel Bourg.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.debian.maven;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+
+/**
+ * Helper building a Maven repository for the tests.
+ */
+class TestRepository {
+
+ /**
+ * Installs a POM with the specified packaging in the repository.
+ */
+ static void install(File repository, String groupId, String artifactId, String version, String packaging) throws IOException {
+ File dir = new File(repository, groupId.replace('.', '/') + "/" + artifactId + "/" + version);
+ dir.mkdirs();
+ String pom = "<project>\n"
+ + " <modelVersion>4.0.0</modelVersion>\n"
+ + " <groupId>" + groupId + "</groupId>\n"
+ + " <artifactId>" + artifactId + "</artifactId>\n"
+ + " <version>" + version + "</version>\n"
+ + " <packaging>" + packaging + "</packaging>\n"
+ + "</project>\n";
+ Files.write(new File(dir, artifactId + "-" + version + ".pom").toPath(), pom.getBytes(StandardCharsets.UTF_8));
+ }
+}
=====================================
maven-packager-utils/pom.xml
=====================================
@@ -6,7 +6,7 @@
<parent>
<artifactId>maven-debian</artifactId>
<groupId>org.debian.maven</groupId>
- <version>2.6</version>
+ <version>2.7</version>
</parent>
<artifactId>maven-packager-utils</artifactId>
=====================================
maven-packager-utils/src/main/java/org/debian/maven/packager/util/IgnoreDependencyQuestions.java
=====================================
@@ -58,6 +58,9 @@ public class IgnoreDependencyQuestions {
{"org.sonatype.plugins", "nexus-staging-maven-plugin"},
{"org.sonatype.ossindex.maven", "ossindex-maven-plugin"},
{"org.eluder.coveralls", "coveralls-maven-plugin"},
+ {"com.github.siom79.japicmp", "japicmp-maven-plugin"},
+ {"org.cyclonedx", "cyclonedx-maven-plugin"},
+ {"org.sonatype.central", "central-publishing-maven-plugin"},
};
private static final String[][] PLUGINS_THAT_CAN_BE_IGNORED = {
@@ -78,6 +81,7 @@ public class IgnoreDependencyQuestions {
{"org.codehaus.mojo", "failsafe-maven-plugin"},
{"org.codehaus.mojo", "shitty-maven-plugin"},
{"org.glassfish.copyright", "glassfish-copyright-maven-plugin"},
+ {"com.mycila", "license-maven-plugin"},
{"com.mycila.maven-license-plugin", "maven-license-plugin"},
{"com.google.code.maven-license-plugin", "maven-license-plugin"},
};
@@ -94,6 +98,7 @@ public class IgnoreDependencyQuestions {
{"org.apache.maven.plugins", "maven-surefire-report-plugin"},
{"org.apache.maven.plugins", "maven-pdf-plugin"},
{"org.apache.maven.plugins", "maven-site-plugin"},
+ {"org.apache.maven.plugins", "maven-plugin-report-plugin"},
{"org.codehaus.mojo", "changes-maven-plugin"},
{"org.codehaus.mojo", "clirr-maven-plugin"},
{"org.codehaus.mojo", "cobertura-maven-plugin"},
=====================================
maven-packager-utils/src/main/resources/control.vm
=====================================
@@ -15,14 +15,13 @@ $space
#end
Source: ${package}
Section: java
-Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
Uploaders: ${packager} <${packagerEmail}>
-Build-Depends: debhelper-compat (= 13), default-jdk, maven-debian-helper (>= 2.6)
+Build-Depends: debhelper-compat (= 13), default-jdk, maven-debian-helper (>= 2.7)
#if(!$buildDependencies.isEmpty())
Build-Depends-Indep:#printDependencies($buildDependencies)$space
#end
-Standards-Version: 4.7.0
+Standards-Version: 4.7.4
Vcs-Git: https://salsa.debian.org/java-team/${package}.git
Vcs-Browser: https://salsa.debian.org/java-team/${package}
Homepage:#if(${project.Url}) ${project.Url}#else TODO #end
=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
<groupId>org.debian.maven</groupId>
<artifactId>maven-debian</artifactId>
- <version>2.6</version>
+ <version>2.7</version>
<packaging>pom</packaging>
<description>Helper tools for using Maven to build Debian packages</description>
View it on GitLab: https://salsa.debian.org/java-team/maven-debian-helper/-/compare/a4c111421f26e89f4b50b5a91e16cf10487e7278...cbaa6a8aa3d82f47ab8790c68b0a56df7e27147e
--
View it on GitLab: https://salsa.debian.org/java-team/maven-debian-helper/-/compare/a4c111421f26e89f4b50b5a91e16cf10487e7278...cbaa6a8aa3d82f47ab8790c68b0a56df7e27147e
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261024/4e492a6b/attachment.htm>
More information about the pkg-java-commits
mailing list