Skip to content

Commit

Permalink
Merge branch 'master' into m-api
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Mar 24, 2023
2 parents 1741d32 + d458eb1 commit f9ccb64
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ under the License.
<mavenSurefirePluginVersion>${surefire.version}</mavenSurefirePluginVersion>
<mavenWarPluginVersion>3.3.2</mavenWarPluginVersion>

<project.build.outputTimestamp>2023-02-06T12:43:51Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-03-21T14:38:01Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down
32 changes: 29 additions & 3 deletions src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>true</code> 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,
Expand Down Expand Up @@ -254,9 +266,23 @@ private ArtifactDeployerRequest createDeployerRequest() {
artifactManager.setPath(pomArtifact, pomPath);
deployables.add(pomArtifact);
// main artifact
if (!isValidPath.test(artifact) && !attachedArtifacts.isEmpty()) {
throw new MojoException("The packaging plugin for this project did not assign "
+ "a main file to the project but it has attachments. Change packaging to 'pom'.");
if (!isValidPath.test(artifact)) {
if (!attachedArtifacts.isEmpty()) {
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");
}
}
deployables.add(artifact);
} else {
Expand Down

0 comments on commit f9ccb64

Please sign in to comment.