You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/09/11 18:57:38 UTC
(maven-doap-plugin) 01/01: Allow overriding the file-release artifact classifier and type
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch agent/doap-file-release-classifier
in repository https://gitbox.apache.org/repos/asf/maven-doap-plugin.git
commit b53db980aa7c98cf7d03bc9f1ac0f79b4cb60ed3
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Sep 11 20:57:23 2026 +0200
Allow overriding the file-release artifact classifier and type
writeReleases() derived doap:file-release from the project's packaging
type only, so jar/war/etc.-packaged ASF projects pointed at the wrong
artifact instead of the distributed *-source-release.zip. Two new
mojo parameters, fileReleaseClassifier and fileReleaseType, let a
project override what artifact the release entry resolves to; the
existence check against the remote repository is updated to include
the classifier too, since it previously ignored it.
Default behavior (no classifier/type override) is unchanged.
Fixes #102
---
.../org/apache/maven/plugin/doap/DoapMojo.java | 41 +++++++++++++++++++---
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java b/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
index 03ac0e8..657e11d 100644
--- a/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
+++ b/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java
@@ -206,6 +206,25 @@ public class DoapMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true)
private List<ArtifactRepository> remoteRepositories;
+ /**
+ * The classifier of the artifact to reference as <code>doap:file-release</code>, e.g.
+ * <code>source-release</code> for the ASF source-release archive. When not set, the release artifact is
+ * resolved without a classifier, as before.
+ *
+ * @since 3.0.0-M2
+ */
+ @Parameter(property = "fileReleaseClassifier")
+ private String fileReleaseClassifier;
+
+ /**
+ * The type of the artifact to reference as <code>doap:file-release</code>, e.g. <code>zip</code> for the
+ * ASF source-release archive. Defaults to the project's packaging.
+ *
+ * @since 3.0.0-M2
+ */
+ @Parameter(property = "fileReleaseType")
+ private String fileReleaseType;
+
/**
* Factory for creating artifact objects.
*
@@ -1356,8 +1375,12 @@ public class DoapMojo extends AbstractMojo {
// list all file release from all remote repos
for (ArtifactRepository repo : remoteRepositories) {
- Artifact artifactRelease = artifactFactory.createArtifact(
- project.getGroupId(), project.getArtifactId(), version, null, project.getPackaging());
+ String type = (fileReleaseType != null) ? fileReleaseType : project.getPackaging();
+ Artifact artifactRelease = (fileReleaseClassifier != null)
+ ? artifactFactory.createArtifactWithClassifier(
+ project.getGroupId(), project.getArtifactId(), version, type, fileReleaseClassifier)
+ : artifactFactory.createArtifact(
+ project.getGroupId(), project.getArtifactId(), version, null, type);
if (artifactRelease == null) {
continue;
@@ -1455,9 +1478,17 @@ public class DoapMojo extends AbstractMojo {
private boolean isArtifactInRepository(Artifact artifact, ArtifactRepository repository) {
// Convert Legacy Artifact to Aether Artifact
- String artifactCoordinates = String.format(
- "%s:%s:%s:%s",
- artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getVersion());
+ String artifactCoordinates = StringUtils.isEmpty(artifact.getClassifier())
+ ? String.format(
+ "%s:%s:%s:%s",
+ artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getVersion())
+ : String.format(
+ "%s:%s:%s:%s:%s",
+ artifact.getGroupId(),
+ artifact.getArtifactId(),
+ artifact.getType(),
+ artifact.getClassifier(),
+ artifact.getVersion());
org.eclipse.aether.artifact.Artifact aetherArtifact =
new org.eclipse.aether.artifact.DefaultArtifact(artifactCoordinates);