Skip to content

Commit

Permalink
Bugfix - Limit 'mvn deploy' to work with only install/deploy phases (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Mar 16, 2022
1 parent e885e9c commit 9a56972
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import static org.jfrog.build.extractor.BuildInfoExtractorUtils.getModuleIdString;
import static org.jfrog.build.extractor.BuildInfoExtractorUtils.getTypeString;
import static org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration.addDefaultPublisherAttributes;
import static org.jfrog.build.extractor.clientConfiguration.ClientConfigurationFields.PUBLISH_ARTIFACTS;
import static org.jfrog.build.extractor.clientConfiguration.ClientConfigurationFields.PUBLISH_BUILD_INFO;

/**
* Will be called for every project/module in the Maven project.
Expand Down Expand Up @@ -739,10 +741,13 @@ private void setDeploymentPolicy(ExecutionEvent event) {
event.getSession().getUserProperties().put("maven.deploy.skip", Boolean.TRUE.toString());
return;
}
// Skip the artifact deployment behavior if the goals do not contain install phases.
// Skip the artifact deployment behavior if the goals do not contain install or deploy phases.
if (!goals.contains("install")) {
conf.publisher.setPublishArtifacts(false);
conf.publisher.setPublishBuildInfo(false);

conf.publisher.setLegacyBooleanValue(PUBLISH_ARTIFACTS, false);
conf.publisher.setLegacyBooleanValue(PUBLISH_BUILD_INFO, false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public void setBooleanValue(String key, Boolean value) {
}
}

public void setLegacyBooleanValue(String key, Boolean value) {
if (value == null) {
props.remove(getDeprecatedPrefix() + key);
} else {
props.put(getDeprecatedPrefix() + key, value.toString());
}
}

public Integer getIntegerValue(String key) {
return getIntegerValue(key, null);
}
Expand Down

0 comments on commit 9a56972

Please sign in to comment.