All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.plugin.deployment.RedeployMojo Maven / Gradle / Ivy

Go to download

A maven plugin that allows various management operations to be executed on WildFly Application Server.

There is a newer version: 5.1.1.Final
Show 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.ResolutionScope;
import org.wildfly.plugin.tools.Deployment;
import org.wildfly.plugin.tools.DeploymentManager;
import org.wildfly.plugin.tools.DeploymentResult;

/**
 * Redeploys the application to the WildFly Application Server.
 *
 * @author James R. Perkins
 */
@Mojo(name = "redeploy", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
@Execute(phase = LifecyclePhase.PACKAGE)
public class RedeployMojo extends AbstractAppDeployment {

    @Override
    public String goal() {
        return "redeploy";
    }

    @Override
    protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment)
            throws IOException, MojoDeploymentException {
        // Ensure the deployment exists before attempting to redeploy it
        if (!deploymentManager.hasDeployment(deployment.getName())) {
            throw new MojoDeploymentException(
                    "The deployment %s does not exist in the content repository and cannot be redeployed.",
                    deployment.getName());
        }
        return deploymentManager.redeploy(deployment);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy