You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/08/14 13:02:06 UTC
(maven-deploy-plugin) branch MDEPLOY-311 created (now 8ae86c8)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a change to branch MDEPLOY-311
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
at 8ae86c8 [MDEPLOY-311] Consider packaging in deploy-file mojo
This branch includes the following new commits:
new 8ae86c8 [MDEPLOY-311] Consider packaging in deploy-file mojo
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-deploy-plugin) 01/01: [MDEPLOY-311] Consider packaging in deploy-file mojo
Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch MDEPLOY-311
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit 8ae86c81addb5ba8296c4640ddb3b033e31b0569
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Wed Aug 14 15:01:26 2024 +0200
[MDEPLOY-311] Consider packaging in deploy-file mojo
The packaging was not really considered.
---
https://issues.apache.org/jira/browse/MDEPLOY-311
---
.../maven/plugins/deploy/DeployFileMojo.java | 23 +++++++++++++---------
.../apache/maven/plugins/deploy/DeployMojo.java | 1 +
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
index 7e6536f..fe5ab05 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -229,6 +229,7 @@ public class DeployFileMojo extends AbstractDeployMojo {
}
}
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (Boolean.parseBoolean(skip)
|| ("releases".equals(skip) && !ArtifactUtils.isSnapshot(version))
@@ -264,19 +265,23 @@ public class DeployFileMojo extends AbstractDeployMojo {
DeployRequest deployRequest = new DeployRequest();
deployRequest.setRepository(remoteRepository);
- boolean isFilePom = classifier == null && "pom".equals(packaging);
- if (!isFilePom) {
+ String mainArtifactExtension;
+ if (classifier == null && "pom".equals(packaging)) {
+ mainArtifactExtension = "pom";
+ } else {
ArtifactType artifactType =
session.getRepositorySession().getArtifactTypeRegistry().get(packaging);
- if (artifactType != null
- && (classifier == null || classifier.isEmpty())
- && !StringUtils.isEmpty(artifactType.getClassifier())) {
- classifier = artifactType.getClassifier();
+ if (artifactType != null) {
+ if (StringUtils.isEmpty(classifier) && !StringUtils.isEmpty(artifactType.getClassifier())) {
+ classifier = artifactType.getClassifier();
+ }
+ mainArtifactExtension = artifactType.getExtension();
+ } else {
+ mainArtifactExtension = packaging;
}
}
- Artifact mainArtifact = new DefaultArtifact(
- groupId, artifactId, classifier, isFilePom ? "pom" : getExtension(file), version)
- .setFile(file);
+ Artifact mainArtifact =
+ new DefaultArtifact(groupId, artifactId, classifier, mainArtifactExtension, version).setFile(file);
deployRequest.addArtifact(mainArtifact);
File artifactLocalFile = getLocalRepositoryFile(session.getRepositorySession(), mainArtifact);
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
index 79ee1d8..2c58661 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -180,6 +180,7 @@ public class DeployMojo extends AbstractDeployMojo {
return pluginContext.containsKey(DEPLOY_PROCESSED_MARKER);
}
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
State state;
if (Boolean.parseBoolean(skip)