@@ -126,6 +126,18 @@ public class DeployMojo extends AbstractDeployMojo {
126
126
@ Parameter (property = "maven.deploy.skip" , defaultValue = "false" )
127
127
private String skip = Boolean .FALSE .toString ();
128
128
129
+ /**
130
+ * Set this to <code>true</code> to allow incomplete project processing. By default, such projects are forbidden
131
+ * and Mojo will fail to process them. Incomplete project is a Maven Project that has any other packaging than
132
+ * "pom" and has no main artifact packaged. In the majority of cases, what user really wants here is a project
133
+ * with "pom" packaging and some classified artifact attached (typical example is some assembly being packaged
134
+ * and attached with classifier).
135
+ *
136
+ * @since 3.1.1
137
+ */
138
+ @ Parameter (defaultValue = "false" , property = "allowIncompleteProjects" )
139
+ private boolean allowIncompleteProjects ;
140
+
129
141
private enum State {
130
142
SKIPPED ,
131
143
DEPLOYED ,
@@ -285,8 +297,17 @@ private void processProject(final MavenProject project, DeployRequest request) t
285
297
if (isFile (mavenMainArtifact .getFile ())) {
286
298
request .addArtifact (RepositoryUtils .toArtifact (mavenMainArtifact ));
287
299
} else if (!project .getAttachedArtifacts ().isEmpty ()) {
288
- throw new MojoExecutionException ("The packaging plugin for this project did not assign "
289
- + "a main file to the project but it has attachments. Change packaging to 'pom'." );
300
+ if (allowIncompleteProjects ) {
301
+ getLog ().warn ("" );
302
+ getLog ().warn ("The packaging plugin for this project did not assign" );
303
+ getLog ().warn ("a main file to the project but it has attachments. Change packaging to 'pom'." );
304
+ getLog ().warn ("" );
305
+ getLog ().warn ("Incomplete projects like this will fail in future Maven versions!" );
306
+ getLog ().warn ("" );
307
+ } else {
308
+ throw new MojoExecutionException ("The packaging plugin for this project did not assign "
309
+ + "a main file to the project but it has attachments. Change packaging to 'pom'." );
310
+ }
290
311
} else {
291
312
throw new MojoExecutionException (
292
313
"The packaging for this project did not assign a file to the build artifact" );
0 commit comments