Skip to content

Commit

Permalink
[MDEPLOY-267] change type of skip parameter to String with possible v…
Browse files Browse the repository at this point in the history
…alues releases,snapshots,true default will be false

Signed-off-by: olivier lamy <olamy@apache.org>
  • Loading branch information
olamy committed May 18, 2020
1 parent 8795786 commit 70faeae
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/it/skip-release-jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ under the License.
<artifactId>maven-deploy-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<skipRelease>true</skipRelease>
<skip>releases</skip>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/it/skip-snapshot-jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ under the License.
<artifactId>maven-deploy-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<skipSnapshot>true</skipSnapshot>
<skip>snapshots</skip>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/it/skip-snapshot-jar/setup.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.util.*;

import org.codehaus.plexus.util.*;

File file = new File( localRepositoryPath, "org" );
File file = new File( localRepositoryPath, "org/apache/maven/its/deploy/ssj" );
System.out.println( "Deleting " + file );
FileUtils.deleteDirectory( file );

Expand Down
30 changes: 11 additions & 19 deletions src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,17 @@ public class DeployMojo

/**
* Set this to 'true' to bypass artifact deploy
*
* Since since 3.0.0-M2 it's not anymore a real boolean as it can have more than 2 values:
* <ul>
* <li><code>true</code>: will skip as usual</li>
* <li><code>releases</code>: will skip if current version of the project is a release</li>
* <li><code>snapshots</code>: will skip if current version of the project is a snapshot</li>
* <li>any other values will be considered as <code>false</code></li>
* </ul>
* @since 2.4
*/
@Parameter( property = "maven.deploy.skip", defaultValue = "false" )
private boolean skip;

/**
* If 'true' release artifacts will not be deployed
* @since 3.0.0-M2
*/
@Parameter( property = "maven.deploy.skipRelease", defaultValue = "false" )
private boolean skipRelease;

/**
* If 'true' snapshot artifacts will not be deployed
* @since 3.0.0-M2
*/
@Parameter( property = "maven.deploy.skipSnapshot", defaultValue = "false" )
private boolean skipSnapshot;
private String skip = Boolean.FALSE.toString();

/**
* Component used to deploy project.
Expand All @@ -154,9 +146,9 @@ public void execute()
throws MojoExecutionException, MojoFailureException
{
boolean addedDeployRequest = false;
if ( skip
|| ( skipRelease && !ArtifactUtils.isSnapshot( project.getVersion() ) )
|| ( skipSnapshot && ArtifactUtils.isSnapshot( project.getVersion() ) )
if ( Boolean.parseBoolean( skip )
|| ( "releases".equals( skip ) && !ArtifactUtils.isSnapshot( project.getVersion() ) )
|| ( "snapshots".equals( skip ) && ArtifactUtils.isSnapshot( project.getVersion() ) )
)
{
getLog().info( "Skipping artifact deployment" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void testSkippingDeploy()
assertEquals( "file", repo.getProtocol() );
assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );

setVariableValueToObject( mojo, "skip", Boolean.TRUE );
setVariableValueToObject( mojo, "skip", Boolean.TRUE.toString() );

mojo.execute();

Expand Down

0 comments on commit 70faeae

Please sign in to comment.