org.wildfly.plugin.deployment.DeployMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-maven-plugin Show documentation
Show all versions of wildfly-maven-plugin Show documentation
A maven plugin that allows various management operations to be executed on WildFly Application
Server.
The newest version!
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.plugin.deployment;
import java.io.IOException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.wildfly.plugin.common.PropertyNames;
import org.wildfly.plugin.tools.Deployment;
import org.wildfly.plugin.tools.DeploymentManager;
import org.wildfly.plugin.tools.DeploymentResult;
/**
* Deploys the application to the WildFly Application Server.
*
* If {@code force} is set to {@code true}, the server is queried to see if the application already exists. If the
* application already exists, the application is redeployed instead of deployed. If the application does not exist the
* application is deployed as normal.
*
* If {@code force} is set to {@code false} and the application has already been deployed to the server, an error
* will occur and the deployment will fail.
*
* @author James R. Perkins
*/
@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class DeployMojo extends AbstractAppDeployment {
/**
* Specifies whether force mode should be used or not.
*
* If force mode is disabled, the deploy goal will cause a build failure if the application being deployed already
* exists.
*/
@Parameter(defaultValue = "true", property = PropertyNames.DEPLOY_FORCE)
private boolean force;
@Override
public String goal() {
return "deploy";
}
@Override
protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment)
throws IOException {
if (force) {
return deploymentManager.forceDeploy(deployment);
}
return deploymentManager.deploy(deployment);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy