Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFMP-175] Add property to skip the deployment in the package goal. #256

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -97,6 +97,8 @@ public interface PropertyNames {

String SKIP_PACKAGE = "wildfly.package.skip";

String SKIP_PACKAGE_DEPLOYMENT = "wildfly.package.deployment.skip";

String STARTUP_TIMEOUT = "wildfly.startupTimeout";

String STDOUT = "wildfly.stdout";
Expand Down
Expand Up @@ -160,6 +160,12 @@ public class PackageServerMojo extends AbstractProvisionServerMojo {
@Parameter(defaultValue = "false", property = PropertyNames.SKIP_PACKAGE)
private boolean skip;

/**
* Skip deploying the deployment after the server is provisioned ({@code false} by default).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is any reason to change this, but just as an FYI the default will automatically be added in the generated site. For example https://docs.wildfly.org/wildfly-maven-plugin/package-mojo.html#offlineProvisioning

*/
@Parameter(defaultValue = "false", property = PropertyNames.SKIP_PACKAGE)
protected boolean skipDeployment;

@Inject
private OfflineCommandExecutor commandExecutor;

Expand Down Expand Up @@ -198,19 +204,22 @@ protected void serverProvisioned(Path jbossHome) throws MojoExecutionException,
throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
}

final Path deploymentContent = getDeploymentContent();
if (Files.exists(deploymentContent)) {
getLog().info("Deploying " + deploymentContent);
List<String> deploymentCommands = getDeploymentCommands(deploymentContent);
final BaseCommandConfiguration cmdConfigDeployment = new BaseCommandConfiguration.Builder()
.addCommands(deploymentCommands)
.setJBossHome(jbossHome)
.addCLIArguments(CLI_ECHO_COMMAND_ARG)
.setAppend(true)
.setStdout(stdout)
.build();
commandExecutor.execute(cmdConfigDeployment, artifactResolver);
if (!skipDeployment) {
final Path deploymentContent = getDeploymentContent();
if (Files.exists(deploymentContent)) {
getLog().info("Deploying " + deploymentContent);
List<String> deploymentCommands = getDeploymentCommands(deploymentContent);
final BaseCommandConfiguration cmdConfigDeployment = new BaseCommandConfiguration.Builder()
.addCommands(deploymentCommands)
.setJBossHome(jbossHome)
.addCLIArguments(CLI_ECHO_COMMAND_ARG)
.setAppend(true)
.setStdout(stdout)
.build();
commandExecutor.execute(cmdConfigDeployment, artifactResolver);
}
}

// CLI execution
try {
if (!packagingScripts.isEmpty()) {
Expand Down