From 04f5e8856adbe9019476d9a0aba6c8de95bdf107 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Tue, 21 Mar 2023 15:24:08 +0100 Subject: [PATCH 1/3] [MDEPLOY-308] Add parameter to lax project validation (#39) * [MDEPLOY-308] Add parameter to lax project validation --- https://issues.apache.org/jira/browse/MDEPLOY-308 * Reformat --- .../maven/plugins/deploy/DeployMojo.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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 4e317acf..c9b0d4a4 100644 --- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java +++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java @@ -126,6 +126,18 @@ public class DeployMojo extends AbstractDeployMojo { @Parameter(property = "maven.deploy.skip", defaultValue = "false") private String skip = Boolean.FALSE.toString(); + /** + * Set this to true to allow incomplete project processing. By default, such projects are forbidden + * and Mojo will fail to process them. Incomplete project is a Maven Project that has any other packaging than + * "pom" and has no main artifact packaged. In the majority of cases, what user really wants here is a project + * with "pom" packaging and some classified artifact attached (typical example is some assembly being packaged + * and attached with classifier). + * + * @since 3.1.1 + */ + @Parameter(defaultValue = "false", property = "allowIncompleteProjects") + private boolean allowIncompleteProjects; + private enum State { SKIPPED, DEPLOYED, @@ -285,8 +297,17 @@ private void processProject(final MavenProject project, DeployRequest request) t if (isFile(mavenMainArtifact.getFile())) { request.addArtifact(RepositoryUtils.toArtifact(mavenMainArtifact)); } else if (!project.getAttachedArtifacts().isEmpty()) { - throw new MojoExecutionException("The packaging plugin for this project did not assign " - + "a main file to the project but it has attachments. Change packaging to 'pom'."); + if (allowIncompleteProjects) { + getLog().warn(""); + getLog().warn("The packaging plugin for this project did not assign"); + getLog().warn("a main file to the project but it has attachments. Change packaging to 'pom'."); + getLog().warn(""); + getLog().warn("Incomplete projects like this will fail in future Maven versions!"); + getLog().warn(""); + } else { + throw new MojoExecutionException("The packaging plugin for this project did not assign " + + "a main file to the project but it has attachments. Change packaging to 'pom'."); + } } else { throw new MojoExecutionException( "The packaging for this project did not assign a file to the build artifact"); From 43aaa63898ed46935e987c269142101a1ddb3d72 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Tue, 21 Mar 2023 15:37:41 +0100 Subject: [PATCH 2/3] [maven-release-plugin] prepare release maven-deploy-plugin-3.1.1 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 680a704b..96df086c 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ under the License. maven-deploy-plugin - 3.1.1-SNAPSHOT + 3.1.1 maven-plugin Apache Maven Deploy Plugin @@ -49,7 +49,7 @@ under the License. scm:git:https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git - HEAD + maven-deploy-plugin-3.1.1 https://github.com/apache/maven-deploy-plugin/tree/${project.scm.tag} @@ -88,7 +88,7 @@ under the License. ${surefire.version} 3.3.2 - 2023-02-06T12:43:51Z + 2023-03-21T14:37:32Z From d458eb11532896a2189547c265cbadaf1e7b6b24 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Tue, 21 Mar 2023 15:38:01 +0100 Subject: [PATCH 3/3] [maven-release-plugin] prepare for next development iteration --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 96df086c..fc75b7c3 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ under the License. maven-deploy-plugin - 3.1.1 + 3.1.2-SNAPSHOT maven-plugin Apache Maven Deploy Plugin @@ -49,7 +49,7 @@ under the License. scm:git:https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git scm:git:https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git - maven-deploy-plugin-3.1.1 + HEAD https://github.com/apache/maven-deploy-plugin/tree/${project.scm.tag} @@ -88,7 +88,7 @@ under the License. ${surefire.version} 3.3.2 - 2023-03-21T14:37:32Z + 2023-03-21T14:38:01Z