diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index a4da1149..00000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-# To get started with Dependabot version updates, you'll need to specify which
-# package ecosystems to update and where the package manifests are located.
-# Please see the documentation for all configuration options:
-# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
-
-version: 2
-updates:
- - package-ecosystem: "maven"
- directory: "/"
- schedule:
- interval: "daily"
- ignore:
- - dependency-name: 'javax.inject:javax.inject'
- update-types: ['version-update:semver-major']
- rebase-strategy: disabled
- open-pull-requests-limit: 10
- - package-ecosystem: "github-actions"
- # Workflow files stored in the
- # default location of `.github/workflows`
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 10
diff --git a/core/pom.xml b/core/pom.xml
index e9df1299..a089f21d 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -8,9 +8,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-parent
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
wildfly-plugin-core
diff --git a/plugin/pom.xml b/plugin/pom.xml
index 2f824a1a..949f8b02 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -8,12 +8,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-parent
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
- wildfly-maven-plugin
+ eap-maven-plugin
maven-plugin
WildFly Maven Plugin
@@ -121,40 +121,15 @@
galleon-api
-
- org.twdata.maven
- mojo-executor
- ${version.org.twdata.maven}
-
-
- *
- *
-
-
-
org.codehaus.plexus
plexus-utils
-
- org.wildfly.core
- wildfly-controller-client
-
+
org.wildfly.launcher
wildfly-launcher
-
-
- org.wildfly.core
- wildfly-protocol
-
-
- org.jboss.modules
- jboss-modules
-
-
-
${project.groupId}
@@ -163,10 +138,22 @@
org.wildfly.plugins
wildfly-plugin-tools
+
+
+ org.wildfly.core
+ *
+
+
org.wildfly.channel
channel-core
+
+
+ com.ethlo.time
+ itu
+
+
org.wildfly.channel
@@ -176,10 +163,6 @@
org.wildfly.prospero
prospero-metadata
-
- org.wildfly.glow
- wildfly-glow-core
-
junit
diff --git a/plugin/src/main/java/org/wildfly/plugin/cli/CommandConfiguration.java b/plugin/src/main/java/org/wildfly/plugin/cli/CommandConfiguration.java
deleted file mode 100644
index e577e77c..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/cli/CommandConfiguration.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-package org.wildfly.plugin.cli;
-
-import java.util.function.Supplier;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-
-/**
- * The configuration used to execute CLI commands.
- *
- * @author James R. Perkins
- */
-public class CommandConfiguration extends BaseCommandConfiguration {
-
- private final Supplier client;
- private final Supplier clientConfiguration;
- private final boolean fork;
- private final boolean offline;
-
- private final boolean autoReload;
-
- protected abstract static class AbstractBuilder>
- extends BaseCommandConfiguration.AbstractBuilder {
-
- private final Supplier client;
- private final Supplier clientConfiguration;
- private boolean fork;
- private boolean offline;
- private boolean autoReload;
-
- AbstractBuilder(final Supplier clientSupplier,
- final Supplier clientConfigurationSupplier) {
- this.client = clientSupplier;
- this.clientConfiguration = clientConfigurationSupplier;
- }
-
- /**
- * Sets whether or not the commands should be executed in a new process.
- *
- * Note that is {@link #isOffline()} is set to {@code true} this has no
- * effect.
- *
- *
- * @param fork {@code true} if commands should be executed in a new
- * process
- *
- * @return this configuration
- */
- public T setFork(final boolean fork) {
- this.fork = fork;
- return builderInstance();
- }
-
- /**
- * Sets whether a client should be associated with the CLI context.
- *
- * Note this launches CLI in a new process.
- *
- *
- * @param offline {@code true} if this should be an offline process
- *
- * @return this configuration
- */
- public T setOffline(final boolean offline) {
- this.offline = offline;
- return builderInstance();
- }
-
- /**
- * Set to {@code true} if a reload should execute after the commands are complete. The reload will only execute
- * if {@link #isOffline()} is {@code false} and the server state is in {@code reload-required}.
- *
- * @param autoReload {@code true} to enable auto-reload
- *
- * @return this configuration
- */
- public T setAutoReload(final boolean autoReload) {
- this.autoReload = autoReload;
- return builderInstance();
- }
-
- @Override
- public CommandConfiguration build() {
- return new CommandConfiguration(this);
- }
- }
-
- public static class Builder extends AbstractBuilder {
-
- Builder(Supplier clientSupplier,
- Supplier clientConfigurationSupplier) {
- super(clientSupplier, clientConfigurationSupplier);
- }
-
- @Override
- protected Builder builderInstance() {
- return this;
- }
- }
-
- protected CommandConfiguration(AbstractBuilder> builder) {
- super(builder);
- client = builder.client;
- clientConfiguration = builder.clientConfiguration;
- fork = builder.fork;
- offline = builder.offline;
- autoReload = builder.autoReload;
- }
-
- /**
- * Creates a new command configuration Builder.
- *
- * @param clientSupplier the supplier used to get a management client
- * @param clientConfigurationSupplier a supplier used to get the client
- * configuration
- *
- * @return a new command configuration Builder.
- */
- public static Builder of(final Supplier clientSupplier,
- final Supplier clientConfigurationSupplier) {
- return new Builder(clientSupplier, clientConfigurationSupplier);
- }
-
- /**
- * Returns the management client.
- *
- * @return the management client
- */
- public ModelControllerClient getClient() {
- return client.get();
- }
-
- /**
- * Returns the management client configuration.
- *
- * @return the management client configuration
- */
- public MavenModelControllerClientConfiguration getClientConfiguration() {
- return clientConfiguration.get();
- }
-
- /**
- * Indicates whether or not CLI commands should be executed in a new
- * process.
- *
- * @return {@code true} to execute CLI commands in a new process
- */
- public boolean isFork() {
- return fork;
- }
-
- /**
- * Indicates whether or not this should be an offline process.
- *
- * @return {@code true} if this should be an offline process, otherwise
- * {@code false}
- */
- public boolean isOffline() {
- return offline;
- }
-
- /**
- * Indicants if the server should be reloaded if the server is in the {@code reload-required} state and
- * {@link #isOffline()} is {@code false}.
- *
- * @return {@code true} if a reload should execute if it's required, otherwise {@code false}
- */
- public boolean isAutoReload() {
- return !offline && autoReload;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/cli/CommandExecutor.java b/plugin/src/main/java/org/wildfly/plugin/cli/CommandExecutor.java
deleted file mode 100644
index 079956de..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/cli/CommandExecutor.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.cli;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.wildfly.core.launcher.CliCommandBuilder;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-import org.wildfly.plugin.common.StandardOutput;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * A command executor for executing CLI commands.
- *
- * @author James R. Perkins
- */
-@Singleton
-@Named
-public class CommandExecutor extends AbstractCommandExecutor {
-
- /**
- * Executes CLI commands based on the configuration.
- *
- * @param config the configuration used to execute the CLI commands
- * @param artifactResolver Resolver to retrieve CLI artifact for in-process execution.
- *
- * @throws MojoFailureException if the JBoss Home directory is required and invalid
- * @throws MojoExecutionException if an error occurs executing the CLI commands
- */
- @Override
- public void execute(final CommandConfiguration config, MavenRepoManager artifactResolver)
- throws MojoFailureException, MojoExecutionException {
- if (config.isOffline()) {
- // The jbossHome is required for offline CLI
- if (!ServerManager.isValidHomeDirectory(config.getJBossHome())) {
- throw new MojoFailureException("Invalid JBoss Home directory is not valid: " + config.getJBossHome());
- }
- executeInNewProcess(config);
- } else {
- if (config.isFork()) {
- executeInNewProcess(config);
- } else {
- try {
- executeInProcess(config, artifactResolver);
- } catch (Exception ex) {
- throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
- }
- }
- }
- if (config.isAutoReload()) {
- // Reload the server if required
- try {
- ServerManager.builder().client(config.getClient()).build().get(config.getTimeout(), TimeUnit.SECONDS)
- .reloadIfRequired(config.getTimeout(),
- TimeUnit.SECONDS);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- throw new MojoExecutionException("Failed to reload server", e);
- }
- }
- }
-
- @Override
- protected int executeInNewProcess(final CommandConfiguration config, final Path scriptFile, final StandardOutput stdout)
- throws MojoExecutionException, IOException {
- try (MavenModelControllerClientConfiguration clientConfiguration = config.getClientConfiguration()) {
-
- final CliCommandBuilder builder = createCommandBuilder(config, scriptFile);
- if (!config.isOffline()) {
- builder.setConnection(clientConfiguration.getController());
- }
- // Configure the authentication config url if defined
- if (clientConfiguration != null && clientConfiguration.getAuthenticationConfigUri() != null) {
- builder.addJavaOption("-Dwildfly.config.url=" + clientConfiguration.getAuthenticationConfigUri().toString());
- }
- return launchProcess(builder, config, stdout);
- }
- }
-
- private void executeInProcess(final CommandConfiguration config, MavenRepoManager artifactResolver) throws Exception {
- // The jbossHome is not required, but if defined should be valid
- final Path jbossHome = config.getJBossHome();
- if (jbossHome != null && !ServerManager.isValidHomeDirectory(jbossHome)) {
- throw new MojoFailureException("Invalid JBoss Home directory is not valid: " + jbossHome);
- }
- final Properties currentSystemProperties = System.getProperties();
- try {
- getLogger().debug("Executing commands");
- // Create new system properties with the defaults set to the current system properties
- final Properties newSystemProperties = new Properties(currentSystemProperties);
-
- // Add the JBoss Home if defined
- if (jbossHome != null) {
- newSystemProperties.setProperty("jboss.home", jbossHome.toString());
- newSystemProperties.setProperty("jboss.home.dir", jbossHome.toString());
- }
-
- for (Path file : config.getPropertiesFiles()) {
- parseProperties(file, newSystemProperties);
- }
-
- newSystemProperties.putAll(config.getSystemProperties());
-
- // Set the system properties for executing commands
- System.setProperties(newSystemProperties);
- LocalCLIExecutor commandContext = null;
- try (ModelControllerClient client = config.getClient()) {
- commandContext = createCommandContext(jbossHome, config.isExpressionResolved(), client, artifactResolver);
- final Collection commands = config.getCommands();
- if (!commands.isEmpty()) {
- if (config.isBatch()) {
- commandContext.executeBatch(commands);
- } else {
- commandContext.executeCommands(commands, config.isFailOnError());
- }
- }
- final Collection scripts = config.getScripts();
- if (!scripts.isEmpty()) {
- for (Path scriptFile : scripts) {
- final List cmds = Files.readAllLines(scriptFile, StandardCharsets.UTF_8);
- if (config.isBatch()) {
- commandContext.executeBatch(cmds);
- } else {
- commandContext.executeCommands(cmds, config.isFailOnError());
- }
- }
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Could not execute commands.", e);
- } finally {
- if (commandContext != null) {
- commandContext.close();
- }
- }
- } catch (IOException e) {
- throw new MojoFailureException("Failed to parse properties.", e);
- } finally {
- System.setProperties(currentSystemProperties);
- }
- }
-
- private LocalCLIExecutor createCommandContext(Path jbossHome, final boolean resolveExpression,
- final ModelControllerClient client,
- MavenRepoManager artifactResolver) throws Exception {
- LocalCLIExecutor commandContext = null;
- try {
- commandContext = new LocalCLIExecutor(jbossHome, resolveExpression, artifactResolver);
- commandContext.bindClient(client);
- } catch (Exception e) {
- // Terminate the session if we've encountered an error
- if (commandContext != null) {
- commandContext.close();
- }
- throw new IllegalStateException("Failed to initialize CLI context", e);
- }
- return commandContext;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/cli/ExecuteCommandsMojo.java b/plugin/src/main/java/org/wildfly/plugin/cli/ExecuteCommandsMojo.java
deleted file mode 100644
index 6fe5d967..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/cli/ExecuteCommandsMojo.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.cli;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.inject.Inject;
-
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.Utils;
-import org.wildfly.plugin.core.MavenRepositoriesEnricher;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * Execute commands to the running WildFly Application Server.
- *
- * Commands should be formatted in the same manner CLI commands are formatted.
- *
- * Executing commands in a batch will rollback all changes if one command fails.
- *
- *
- * <batch>true</batch>
- * <fail-on-error>false</fail-on-error>
- * <commands>
- * <command>/subsystem=logging/console=CONSOLE:write-attribute(name=level,value=DEBUG)</command>
- * </commands>
- *
- *
- * @author James R. Perkins
- */
-@Mojo(name = "execute-commands", threadSafe = true)
-public class ExecuteCommandsMojo extends AbstractServerConnection {
-
- /**
- * {@code true} if commands execution should be skipped.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- /**
- * {@code true} if commands should be executed in a batch or {@code false} if they should be executed one at a
- * time.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.BATCH)
- private boolean batch;
-
- /**
- * The WildFly Application Server's home directory.
- *
- * This parameter is required when {@code offline} is set to {@code true}. Otherwise this is not required, but
- * should be used for commands such as {@code module add} as they are executed on the local file system.
- *
- */
- @Parameter(alias = "jboss-home", property = PropertyNames.JBOSS_HOME)
- private String jbossHome;
-
- /**
- * The system properties to be set when executing CLI commands.
- */
- @Parameter(alias = "system-properties")
- private Map systemProperties;
-
- /**
- * The properties files to use when executing CLI scripts or commands.
- */
- @Parameter
- private List propertiesFiles = new ArrayList<>();
-
- /**
- * The CLI commands to execute.
- */
- @Parameter(property = PropertyNames.COMMANDS)
- private List commands = new ArrayList<>();
-
- /**
- * The CLI script files to execute.
- */
- @Parameter(property = PropertyNames.SCRIPTS)
- private List scripts = new ArrayList<>();
-
- /**
- * Indicates whether or not subsequent commands should be executed if an error occurs executing a command. A value of
- * {@code false} will continue processing commands even if a previous command execution results in a failure.
- *
- * Note that this value is ignored if {@code offline} is set to {@code true}.
- *
- */
- @Parameter(alias = "fail-on-error", defaultValue = "true", property = PropertyNames.FAIL_ON_ERROR)
- private boolean failOnError = true;
-
- /**
- * Indicates the commands should be run in a new process. If the {@code jboss-home} property is not set an attempt
- * will be made to download a version of WildFly to execute commands on. However it's generally considered best
- * practice to set the {@code jboss-home} property if setting this value to {@code true}.
- *
- * Note that if {@code offline} is set to {@code true} this setting really has no effect.
- *
- *
- * WARNING: In 3.0.0 you'll be required to set the {@code jboss-home}. An error will occur if
- * this option is {@code true} and the {@code jboss-home} is not set.
- *
- *
- * @since 2.0.0
- */
- @Parameter(defaultValue = "false", property = "wildfly.fork")
- private boolean fork;
-
- /**
- * Indicates whether or not CLI scrips or commands should be executed in an offline mode. This is useful for using
- * an embedded server or host controller.
- *
- *
- * This does not start an embedded server it instead skips checking if a server is running.
- *
- */
- @Parameter(name = "offline", defaultValue = "false", property = PropertyNames.OFFLINE)
- private boolean offline = false;
-
- /**
- * Indicates how {@code stdout} and {@code stderr} should be handled for the spawned CLI process. Currently a new
- * process is only spawned if {@code offline} is set to {@code true} or {@code fork} is set to {@code true}. Note
- * that {@code stderr} will be redirected to {@code stdout} if the value is defined unless the value is
- * {@code none}.
- *
- * By default {@code stdout} and {@code stderr} are inherited from the current process. You can change the setting
- * to one of the follow:
- *
- * - {@code none} indicates the {@code stdout} and {@code stderr} stream should not be consumed
- * - {@code System.out} or {@code System.err} to redirect to the current processes (use this option if you
- * see odd behavior from maven with the default value)
- * - Any other value is assumed to be the path to a file and the {@code stdout} and {@code stderr} will be
- * written there
- *
- *
- */
- @Parameter(name = "stdout", defaultValue = "System.out", property = PropertyNames.STDOUT)
- private String stdout;
-
- /**
- * The JVM options to pass to the offline process if the {@code offline} configuration parameter is set to
- * {@code true}.
- */
- @Parameter(alias = "java-opts", property = PropertyNames.JAVA_OPTS)
- private String[] javaOpts;
-
- /**
- * Automatically reloads the server if the commands leave the server in the "reload-required" state. Note a reload
- * will not be done if {@code offline} is set to {@code true}.
- *
- * @since 4.2.1
- */
- @Parameter(alias = "auto-reload", defaultValue = "true", property = PropertyNames.AUTO_RELOAD)
- private boolean autoReload;
-
- @Component
- RepositorySystem repoSystem;
-
- @Parameter(defaultValue = "${repositorySystemSession}", readonly = true, required = true)
- private RepositorySystemSession session;
-
- @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true)
- private List repositories;
-
- @Parameter(defaultValue = "${project}", readonly = true, required = true)
- MavenProject project;
-
- @Parameter(defaultValue = "${session}", readonly = true, required = true)
- MavenSession mavenSession;
-
- @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true)
- private File buildDir;
-
- /**
- * Resolve expressions prior to send the commands to the server.
- *
- * @since 3.0
- */
- @Parameter(alias = "resolve-expressions", defaultValue = "false", property = PropertyNames.RESOLVE_EXPRESSIONS)
- private boolean resolveExpressions;
-
- @Inject
- private CommandExecutor commandExecutor;
-
- private MavenRepoManager mavenRepoManager;
-
- @Override
- public String goal() {
- return "execute-commands";
- }
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- getLog().debug("Skipping commands execution");
- return;
- }
- MavenRepositoriesEnricher.enrich(mavenSession, project, repositories);
- mavenRepoManager = new MavenArtifactRepositoryManager(repoSystem, session, repositories);
- final CommandConfiguration.Builder cmdConfigBuilder = CommandConfiguration
- .of(this::createClient, this::getClientConfiguration)
- .addCommands(commands)
- .addJvmOptions(javaOpts)
- .addPropertiesFiles(propertiesFiles)
- .addScripts(scripts)
- .addSystemProperties(systemProperties)
- .setBatch(batch)
- .setFailOnError(failOnError)
- .setFork(fork)
- .setJBossHome(jbossHome)
- .setOffline(offline)
- .setAutoReload(autoReload)
- .setStdout(stdout)
- .setTimeout(timeout)
- .setResolveExpression(resolveExpressions);
- // Why is that? fork implies a jboss-home?
- if (fork) {
- cmdConfigBuilder.setJBossHome(getInstallation(buildDir.toPath().resolve(Utils.WILDFLY_DEFAULT_DIR)));
- }
- commandExecutor.execute(cmdConfigBuilder.build(), mavenRepoManager);
- // Check the server state if we're not in offline mode
- if (!offline) {
- try (ModelControllerClient client = createClient()) {
- final String serverState = ServerManager.builder().client(client).build().get(timeout, TimeUnit.SECONDS)
- .serverState();
- if (!ClientConstants.CONTROLLER_PROCESS_STATE_RUNNING.equals(serverState)) {
- getLog().warn(String.format(
- "The server may be in an unexpected state for further interaction. The current state is %s",
- serverState));
- }
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- final Log log = getLog();
- log.warn(String.format(
- "Failed to determine the server-state. The server may be in an unexpected state. Failure: %s",
- e.getMessage()));
- if (log.isDebugEnabled()) {
- log.debug(e);
- }
- }
- }
- }
-
- @Override
- protected int getManagementPort() {
- // Check the java-opts for a management port override
- if (javaOpts != null) {
- for (String opt : javaOpts) {
- if (opt.startsWith("-Djboss.management.http.port=") || opt.startsWith("-Djboss.management.https.port=")) {
- final int equals = opt.indexOf('=');
- return Integer.parseInt(opt.substring(equals + 1).trim());
- }
- if (opt.startsWith("-Djboss.socket.binding.port-offset=")) {
- final int equals = opt.indexOf('=');
- return super.getManagementPort() + Integer.parseInt(opt.substring(equals + 1).trim());
- }
- }
- }
- return super.getManagementPort();
- }
-
- @Override
- protected String getManagementHostName() {
- // Check the java-opts for a management port override
- if (javaOpts != null) {
- for (String opt : javaOpts) {
- if (opt.startsWith("-Djboss.bind.address.management=")) {
- final int equals = opt.indexOf('=');
- return opt.substring(equals + 1).trim();
- }
- }
- }
- return super.getManagementHostName();
- }
-
- /**
- * Allows the {@link #javaOpts} to be set as a string. The string is assumed to be space delimited.
- *
- * @param value a spaced delimited value of JVM options
- */
- @SuppressWarnings("unused")
- public void setJavaOpts(final String value) {
- if (value != null) {
- javaOpts = value.split("\\s+");
- }
- }
-
- private Path getInstallation(Path installDir) throws MojoFailureException {
- if (jbossHome != null) {
- return Paths.get(jbossHome);
- }
- if (!Files.exists(installDir)) {
- throw new MojoFailureException("No server installed.");
- }
- return installDir;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/cli/LocalCLIExecutor.java b/plugin/src/main/java/org/wildfly/plugin/cli/LocalCLIExecutor.java
deleted file mode 100644
index ca1d7844..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/cli/LocalCLIExecutor.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-package org.wildfly.plugin.cli;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.galleon.universe.maven.MavenArtifact;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.wildfly.plugin.tools.cli.CLIWrapper;
-
-/**
- * A CLI executor, resolving CLI artifact from Maven.
- * We can't have embedded/jboss modules in plugin classpath, it causes issue because we are
- * sharing the same jboss module classes between execution run inside the same
- * JVM.
- *
- * @author jdenise
- */
-public class LocalCLIExecutor {
-
- private static final String CLI_GROUP_ID = "org.wildfly.core";
- private static final String CLI_ARTIFACT_ID = "wildfly-cli";
- private static final String CLI_CLASSIFIER = "client";
- private static final String CLI_TYPE = "jar";
- private static final String WILDLY_CORE_VERSION_PROPERTY = "version.org.wildfly.core";
-
- private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
- private final ClassLoader originalCl;
- private final URLClassLoader cliCl;
- private final CLIWrapper cliWrapper;
-
- public LocalCLIExecutor(Path jbossHome, boolean resolveExpression, MavenRepoManager artifactResolver) throws Exception {
- URL[] cp = new URL[1];
- cp[0] = resolveCLI(artifactResolver);
- originalCl = Thread.currentThread().getContextClassLoader();
- cliCl = new URLClassLoader(cp, originalCl);
- Thread.currentThread().setContextClassLoader(cliCl);
- cliWrapper = new CLIWrapper(jbossHome, resolveExpression, cliCl);
- }
-
- private static URL resolveCLI(MavenRepoManager artifactResolver) throws Exception {
- final URL[] cp = new URL[1];
- MavenArtifact mavenArtifact = new MavenArtifact();
- mavenArtifact.setGroupId(CLI_GROUP_ID);
- mavenArtifact.setArtifactId(CLI_ARTIFACT_ID);
- String version = retrieveCoreVersion(artifactResolver);
- mavenArtifact.setVersion(version);
- mavenArtifact.setClassifier(CLI_CLASSIFIER);
- mavenArtifact.setExtension(CLI_TYPE);
- artifactResolver.resolve(mavenArtifact);
- return mavenArtifact.getPath().toUri().toURL();
- }
-
- public void bindClient(ModelControllerClient client) throws Exception {
- cliWrapper.bindClient(client);
- }
-
- public void executeBatch(Collection commands) throws Exception {
- handle("batch");
- for (String c : commands) {
- handle(c);
- }
- handle("run-batch");
- }
-
- public void executeCommands(final Iterable commands, final boolean failOnError) throws Exception {
- for (String cmd : commands) {
- if (failOnError) {
- handle(cmd);
- } else {
- handleSafe(cmd);
- }
- }
- }
-
- public void handle(String command) throws Exception {
- cliWrapper.handle(command);
- }
-
- public void handleSafe(String command) throws Exception {
- cliWrapper.handleSafe(command);
- }
-
- public String getOutput() {
- return cliWrapper.getOutput();
- }
-
- public void close() throws Exception {
- try {
- cliWrapper.close();
- } finally {
- Thread.currentThread().setContextClassLoader(originalCl);
- try {
- cliCl.close();
- } catch (IOException e) {
- }
- }
- }
-
- public void execute(List commands) throws Exception {
- for (String cmd : commands) {
- handle(cmd);
- }
- }
-
- private static String retrieveCoreVersion(MavenRepoManager artifactResolver) throws Exception {
- InputStream is = LocalCLIExecutor.class.getResourceAsStream("/META-INF/maven/plugin.xml");
- if (is == null) {
- throw new MojoExecutionException("Can't retrieve plugin descriptor");
- }
- PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
- PluginDescriptor pluginDescriptor = builder.build(new InputStreamReader(is, StandardCharsets.UTF_8));
- MavenArtifact mavenArtifact = new MavenArtifact();
- mavenArtifact.setGroupId(pluginDescriptor.getGroupId());
- mavenArtifact.setArtifactId(pluginDescriptor.getArtifactId());
- mavenArtifact.setVersion(pluginDescriptor.getVersion());
- mavenArtifact.setExtension("pom");
- artifactResolver.resolve(mavenArtifact);
-
- Model model = readModel(mavenArtifact.getPath());
-
- Parent artifactParent = model.getParent();
- MavenArtifact parentArtifact = new MavenArtifact();
- parentArtifact.setGroupId(artifactParent.getGroupId());
- parentArtifact.setArtifactId(artifactParent.getArtifactId());
- parentArtifact.setVersion(artifactParent.getVersion());
- parentArtifact.setExtension("pom");
- artifactResolver.resolve(parentArtifact);
-
- Model parentModel = readModel(parentArtifact.getPath());
- return parentModel.getProperties().getProperty(WILDLY_CORE_VERSION_PROPERTY);
- }
-
- private static Model readModel(final Path pomXml) throws IOException {
- try (BufferedReader reader = Files.newBufferedReader(pomXml, getEncoding(pomXml))) {
- final MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();
- final Model model = xpp3Reader.read(reader);
- model.setPomFile(pomXml.toFile());
- return model;
- } catch (org.codehaus.plexus.util.xml.pull.XmlPullParserException ex) {
- throw new IOException("Failed to parse artifact POM model", ex);
- }
- }
-
- private static Charset getEncoding(Path pomXml) throws IOException {
- Charset charset = StandardCharsets.UTF_8;
- try (FileReader fileReader = new FileReader(pomXml.toFile())) {
- XMLStreamReader xmlReader = XML_INPUT_FACTORY.createXMLStreamReader(fileReader);
- try {
- String encoding = xmlReader.getCharacterEncodingScheme();
- if (encoding != null) {
- charset = Charset.forName(encoding);
- }
- } finally {
- xmlReader.close();
- }
- } catch (XMLStreamException ex) {
- throw new IOException("Failed to retrieve encoding for " + pomXml, ex);
- }
- return charset;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/AbstractServerConnection.java b/plugin/src/main/java/org/wildfly/plugin/common/AbstractServerConnection.java
deleted file mode 100644
index e9adf24b..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/common/AbstractServerConnection.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.common;
-
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import javax.inject.Inject;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.settings.Server;
-import org.apache.maven.settings.Settings;
-import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
-import org.apache.maven.settings.crypto.SettingsDecrypter;
-import org.apache.maven.settings.crypto.SettingsDecryptionResult;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.ModelControllerClientConfiguration;
-
-/**
- * The default implementation for connecting to a running WildFly instance
- *
- * @author James R. Perkins
- * @author Stuart Douglas
- */
-public abstract class AbstractServerConnection extends AbstractMojo {
-
- public static final String DEBUG_MESSAGE_NO_CREDS = "No username and password in settings.xml file - falling back to CLI entry";
- public static final String DEBUG_MESSAGE_NO_ID = "No element was found in the POM - Getting credentials from CLI entry";
- public static final String DEBUG_MESSAGE_NO_SERVER_SECTION = "No section was found for the specified id";
- public static final String DEBUG_MESSAGE_NO_SETTINGS_FILE = "No settings.xml file was found in this Mojo's execution context";
- public static final String DEBUG_MESSAGE_POM_HAS_CREDS = "Getting credentials from the POM";
- public static final String DEBUG_MESSAGE_SETTINGS_HAS_CREDS = "Found username and password in the settings.xml file";
- public static final String DEBUG_MESSAGE_SETTINGS_HAS_ID = "Found the server's id in the settings.xml file";
-
- static {
- // This is odd, but if not set we should set the JBoss Logging provider to slf4j as that is what Maven uses
- final String provider = System.getProperty("org.jboss.logging.provider");
- if (provider == null || provider.isBlank()) {
- System.setProperty("org.jboss.logging.provider", "slf4j");
- }
- }
-
- /**
- * The protocol used to connect to the server for management.
- */
- @Parameter(property = PropertyNames.PROTOCOL)
- private String protocol;
-
- /**
- * Specifies the host name of the server where the deployment plan should be executed.
- */
- @Parameter(defaultValue = "localhost", property = PropertyNames.HOSTNAME)
- private String hostname;
-
- /**
- * Specifies the port number the server is listening on.
- */
- @Parameter(defaultValue = "9990", property = PropertyNames.PORT)
- private int port;
-
- /**
- * Specifies the id of the server if the username and password is to be
- * retrieved from the settings.xml file
- */
- @Parameter(property = PropertyNames.ID)
- private String id;
-
- /**
- * Provides a reference to the settings file.
- */
- @Parameter(property = "settings", readonly = true, required = true, defaultValue = "${settings}")
- private Settings settings;
-
- /**
- * Specifies the username to use if prompted to authenticate by the server.
- *
- * If no username is specified and the server requests authentication the user
- * will be prompted to supply the username,
- */
- @Parameter(property = PropertyNames.USERNAME)
- private String username;
-
- /**
- * Specifies the password to use if prompted to authenticate by the server.
- *
- * If no password is specified and the server requests authentication the user
- * will be prompted to supply the password,
- */
- @Parameter(property = PropertyNames.PASSWORD)
- private String password;
-
- /**
- * The timeout, in seconds, to wait for a management connection.
- */
- @Parameter(property = PropertyNames.TIMEOUT, defaultValue = "60")
- protected int timeout;
-
- /**
- * A URL which points to the authentication configuration ({@code wildfly-config.xml}) the client uses to
- * authenticate with the server.
- */
- @Parameter(alias = "authentication-config", property = PropertyNames.WILDFLY_AUTH_CLIENT_CONFIG)
- private URL authenticationConfig;
-
- @Inject
- private SettingsDecrypter settingsDecrypter;
-
- /**
- * The goal of the deployment.
- *
- * @return the goal of the deployment.
- */
- public abstract String goal();
-
- /**
- * Creates a new client.
- *
- * @return the client
- */
- protected ModelControllerClient createClient() {
- return ModelControllerClient.Factory.create(getClientConfiguration());
- }
-
- /**
- * Gets a client configuration used to create a new {@link ModelControllerClient}.
- *
- * @return the configuration to use
- */
- protected synchronized MavenModelControllerClientConfiguration getClientConfiguration() {
- final Log log = getLog();
- String username = this.username;
- String password = this.password;
- if (username == null && password == null) {
- if (id != null) {
- if (settings != null) {
- Server server = settings.getServer(id);
- if (server != null) {
- log.debug(DEBUG_MESSAGE_SETTINGS_HAS_ID);
- password = decrypt(server);
- username = server.getUsername();
- if (username != null && password != null) {
- log.debug(DEBUG_MESSAGE_SETTINGS_HAS_CREDS);
- } else {
- log.debug(DEBUG_MESSAGE_NO_CREDS);
- }
- } else {
- log.debug(DEBUG_MESSAGE_NO_SERVER_SECTION);
- }
- } else {
- log.debug(DEBUG_MESSAGE_NO_SETTINGS_FILE);
- }
- } else {
- log.debug(DEBUG_MESSAGE_NO_ID);
- }
- } else {
- log.debug(DEBUG_MESSAGE_POM_HAS_CREDS);
- }
- final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder()
- .setProtocol(protocol)
- .setHostName(getManagementHostName())
- .setPort(getManagementPort())
- .setConnectionTimeout(timeout * 1000);
- if (authenticationConfig != null) {
- try {
- builder.setAuthenticationConfigUri(authenticationConfig.toURI());
- } catch (URISyntaxException e) {
- throw new RuntimeException("Failed to create URI from " + authenticationConfig, e);
- }
- }
- return new MavenModelControllerClientConfiguration(builder.build(), username, password);
- }
-
- protected int getManagementPort() {
- return port;
- }
-
- protected String getManagementHostName() {
- return hostname;
- }
-
- private String decrypt(final Server server) {
- SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(server));
- return decrypt.getServer().getPassword();
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/Environment.java b/plugin/src/main/java/org/wildfly/plugin/common/Environment.java
index ba90ee0f..10d63913 100644
--- a/plugin/src/main/java/org/wildfly/plugin/common/Environment.java
+++ b/plugin/src/main/java/org/wildfly/plugin/common/Environment.java
@@ -9,7 +9,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
+//import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -17,7 +17,8 @@
import java.util.concurrent.TimeUnit;
import org.jboss.logging.Logger;
-import org.wildfly.security.manager.WildFlySecurityManager;
+
+//import org.wildfly.security.manager.WildFlySecurityManager;
/**
* Utilities for the environment.
@@ -131,17 +132,17 @@ public static boolean isWindows() {
}
private static Path findJavaHome() {
- String path = WildFlySecurityManager.getPropertyPrivileged("java.home", null);
- if (path != null) {
- path = WildFlySecurityManager.getEnvPropertyPrivileged("JAVA_HOME", null);
- }
- if (path == null) {
- return null;
- }
- Path resolved = Paths.get(path);
- if (Files.exists(resolved)) {
- return resolved;
- }
+ // String path = WildFlySecurityManager.getPropertyPrivileged("java.home", null);
+ // if (path != null) {
+ // path = WildFlySecurityManager.getEnvPropertyPrivileged("JAVA_HOME", null);
+ // }
+ // if (path == null) {
+ // return null;
+ // }
+ // Path resolved = Paths.get(path);
+ // if (Files.exists(resolved)) {
+ // return resolved;
+ // }
return null;
}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/GlowMavenMessageWriter.java b/plugin/src/main/java/org/wildfly/plugin/common/GlowMavenMessageWriter.java
deleted file mode 100644
index 1ffb6581..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/common/GlowMavenMessageWriter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-package org.wildfly.plugin.common;
-
-import org.apache.maven.plugin.logging.Log;
-import org.wildfly.glow.GlowMessageWriter;
-
-/**
- *
- * @author jdenise
- */
-public class GlowMavenMessageWriter implements GlowMessageWriter {
-
- private final Log log;
-
- GlowMavenMessageWriter(Log log) {
- this.log = log;
- }
-
- @Override
- public void info(Object s) {
- log.info(s.toString());
- }
-
- @Override
- public void warn(Object s) {
- log.warn(s.toString());
- }
-
- @Override
- public void error(Object s) {
- log.error(s.toString());
- }
-
- @Override
- public void trace(Object s) {
- log.debug(s.toString());
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/MavenModelControllerClientConfiguration.java b/plugin/src/main/java/org/wildfly/plugin/common/MavenModelControllerClientConfiguration.java
deleted file mode 100644
index cc0d64fd..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/common/MavenModelControllerClientConfiguration.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.common;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-
-import javax.net.ssl.SSLContext;
-import javax.security.auth.callback.CallbackHandler;
-
-import org.jboss.as.controller.client.ModelControllerClientConfiguration;
-import org.wildfly.security.SecurityFactory;
-
-/**
- * A configuration used to connect a {@link org.jboss.as.controller.client.ModelControllerClient} or used to connect a
- * CLI {@code CommandContext}
- *
- * @author James R. Perkins
- */
-public class MavenModelControllerClientConfiguration implements ModelControllerClientConfiguration {
-
- private final ModelControllerClientConfiguration delegate;
- private final String username;
- private final String password;
- private final CallbackHandler callbackHandler;
-
- MavenModelControllerClientConfiguration(final ModelControllerClientConfiguration delegate, final String username,
- final String password) {
- this.delegate = delegate;
- this.username = username;
- this.password = password;
- if (delegate.getAuthenticationConfigUri() == null) {
- callbackHandler = new ClientCallbackHandler(username, password);
- } else {
- callbackHandler = delegate.getCallbackHandler();
- }
- }
-
- @Override
- public String getHost() {
- return delegate.getHost();
- }
-
- @Override
- public int getPort() {
- return delegate.getPort();
- }
-
- @Override
- public String getProtocol() {
- return delegate.getProtocol();
- }
-
- @Override
- public int getConnectionTimeout() {
- return delegate.getConnectionTimeout();
- }
-
- @Override
- public CallbackHandler getCallbackHandler() {
- return callbackHandler;
- }
-
- @Override
- public Map getSaslOptions() {
- return delegate.getSaslOptions();
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public SSLContext getSSLContext() {
- return delegate.getSSLContext();
- }
-
- @Override
- public SecurityFactory getSslContextFactory() {
- return delegate.getSslContextFactory();
- }
-
- @Override
- public ExecutorService getExecutor() {
- return delegate.getExecutor();
- }
-
- @Override
- public String getClientBindAddress() {
- return delegate.getClientBindAddress();
- }
-
- @Override
- public URI getAuthenticationConfigUri() {
- return delegate.getAuthenticationConfigUri();
- }
-
- @Override
- public void close() throws IOException {
- delegate.close();
- }
-
- /**
- * The username provided or {@code null} if one was not provided.
- *
- * @return the username or {@code null}
- */
- public String getUsername() {
- return username;
- }
-
- /**
- * The password providedor {@code null} if one was not provided.
- *
- * @return the password or {@code null}
- */
- public char[] getPassword() {
- if (password == null) {
- return null;
- }
- return password.toCharArray();
- }
-
- /**
- * Formats a connection string for CLI to use as it's controller connection.
- *
- * @return the controller string to connect CLI
- */
- public String getController() {
- final StringBuilder controller = new StringBuilder();
- if (getProtocol() != null) {
- controller.append(getProtocol()).append("://");
- }
- if (getHost() != null) {
- controller.append(getHost());
- } else {
- controller.append("localhost");
- }
- if (getPort() > 0) {
- controller.append(':').append(getPort());
- }
- return controller.toString();
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java b/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
deleted file mode 100644
index 391ddae6..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.common;
-
-import static org.jboss.as.controller.client.helpers.ClientConstants.CHILD_TYPE;
-import static org.jboss.as.controller.client.helpers.ClientConstants.DEPLOYMENT;
-import static org.jboss.as.controller.client.helpers.ClientConstants.RECURSIVE;
-import static org.jboss.as.controller.client.helpers.ClientConstants.RESULT;
-
-import java.util.List;
-
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.as.controller.client.helpers.Operations;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.ModelType;
-import org.jboss.dmr.Property;
-
-/**
- * A helper for creating operations.
- *
- * @author James R. Perkins
- */
-public class ServerOperations extends Operations {
-
- public static final String ARCHIVE = "archive";
- public static final String BYTES = "bytes";
- public static final String ENABLE = "enable";
- public static final String ENABLED = "enabled";
- public static final String INPUT_STREAM_INDEX = "input-stream-index";
- public static final String LAUNCH_TYPE = "launch-type";
- public static final String PROFILE = "profile";
- public static final String READ_CHILDREN_NAMES = "read-children-names";
- public static final String READ_RESOURCE = "read-resource";
- public static final String RELOAD = "reload";
-
- /**
- * Parses the result and returns the failure description. If the result was successful, an empty string is
- * returned.
- *
- * @param result the result of executing an operation
- *
- * @return the failure message or an empty string
- */
- public static String getFailureDescriptionAsString(final ModelNode result) {
- if (isSuccessfulOutcome(result)) {
- return "";
- }
- final String msg;
- if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) {
- if (result.hasDefined(ClientConstants.OP)) {
- msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP),
- result.get(ClientConstants.OP_ADDR), result
- .get(ClientConstants.FAILURE_DESCRIPTION));
- } else {
- msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION));
- }
- } else {
- msg = String.format("An unexpected response was found checking the deployment. Result: %s", result);
- }
- return msg;
- }
-
- /**
- * Creates an operation to list the deployments.
- *
- * @return the operation
- */
- public static ModelNode createListDeploymentsOperation() {
- final ModelNode op = createOperation(READ_CHILDREN_NAMES);
- op.get(CHILD_TYPE).set(DEPLOYMENT);
- return op;
- }
-
- /**
- * Creates a remove operation.
- *
- * @param address the address for the operation
- * @param recursive {@code true} if the remove should be recursive, otherwise {@code false}
- *
- * @return the operation
- */
- public static ModelNode createRemoveOperation(final ModelNode address, final boolean recursive) {
- final ModelNode op = createRemoveOperation(address);
- op.get(RECURSIVE).set(recursive);
- return op;
- }
-
- /**
- * Creates an operation to read the attribute represented by the {@code attributeName} parameter.
- *
- * @param attributeName the name of the parameter to read
- *
- * @return the operation
- */
- public static ModelNode createReadAttributeOperation(final String attributeName) {
- return createReadAttributeOperation(new ModelNode().setEmptyList(), attributeName);
- }
-
- public static ModelNode createAddress(final String key, final String name) {
- final ModelNode address = new ModelNode().setEmptyList();
- address.add(key, name);
- return address;
- }
-
- /**
- * Creates an address from the consecutive pairs. If there is an odd number of arguments the last argument will be
- * a wildcard ({@code *}).
- *
- * @param pairs the name/value pairs to create the address for
- *
- * @return the address for the arguments
- */
- public static ModelNode createAddress(final String... pairs) {
- final ModelNode address = new ModelNode().setEmptyList();
- final int len = pairs.length;
- for (int i = 0; i < len; i++) {
- final String key = pairs[i];
- final String name = (++i < len) ? pairs[i] : "*";
- address.add(key, name);
- }
- return address;
- }
-
- /**
- * Creates an operation.
- *
- * @param operation the operation name
- * @param address the address for the operation
- * @param recursive whether the operation is recursive or not
- *
- * @return the operation
- *
- * @throws IllegalArgumentException if the address is not of type {@link ModelType#LIST}
- */
- public static ModelNode createOperation(final String operation, final ModelNode address, final boolean recursive) {
- final ModelNode op = createOperation(operation, address);
- op.get(RECURSIVE).set(recursive);
- return op;
- }
-
- /**
- * Finds the last entry of the address list and returns it as a property.
- *
- * @param address the address to get the last part of
- *
- * @return the last part of the address
- *
- * @throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} or is empty
- */
- public static Property getChildAddress(final ModelNode address) {
- if (address.getType() != ModelType.LIST) {
- throw new IllegalArgumentException("The address type must be a list.");
- }
- final List addressParts = address.asPropertyList();
- if (addressParts.isEmpty()) {
- throw new IllegalArgumentException("The address is empty.");
- }
- return addressParts.get(addressParts.size() - 1);
- }
-
- /**
- * Finds the parent address, everything before the last address part.
- *
- * @param address the address to get the parent
- *
- * @return the parent address
- *
- * @throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} or is empty
- */
- public static ModelNode getParentAddress(final ModelNode address) {
- if (address.getType() != ModelType.LIST) {
- throw new IllegalArgumentException("The address type must be a list.");
- }
- final ModelNode result = new ModelNode();
- final List addressParts = address.asPropertyList();
- if (addressParts.isEmpty()) {
- throw new IllegalArgumentException("The address is empty.");
- }
- for (int i = 0; i < addressParts.size() - 1; ++i) {
- final Property property = addressParts.get(i);
- result.add(property.getName(), property.getValue());
- }
- return result;
- }
-
- /**
- * Reads the result of an operation and returns the result as a string. If the operation does not have a {@link
- * ClientConstants#RESULT} attribute and empty string is returned.
- *
- * @param result the result of executing an operation
- *
- * @return the result of the operation or an empty string
- */
- public static String readResultAsString(final ModelNode result) {
- return (result.hasDefined(RESULT) ? result.get(RESULT).asString() : "");
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/common/Utils.java b/plugin/src/main/java/org/wildfly/plugin/common/Utils.java
index a7596536..46a6da47 100644
--- a/plugin/src/main/java/org/wildfly/plugin/common/Utils.java
+++ b/plugin/src/main/java/org/wildfly/plugin/common/Utils.java
@@ -5,28 +5,12 @@
package org.wildfly.plugin.common;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.logging.Log;
-import org.jboss.galleon.api.GalleonBuilder;
-import org.jboss.galleon.api.GalleonFeaturePack;
-import org.jboss.galleon.api.Provisioning;
-import org.jboss.galleon.api.config.GalleonProvisioningConfig;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.wildfly.glow.Arguments;
-import org.wildfly.glow.GlowSession;
-import org.wildfly.glow.ScanResults;
-import org.wildfly.plugin.provision.GlowConfig;
-import org.wildfly.plugin.tools.GalleonUtils;
-
/**
* A simple utility class.
*
@@ -100,73 +84,4 @@ public static List splitArguments(final CharSequence arguments) {
}
return args;
}
-
- public static ScanResults scanDeployment(GlowConfig discoverProvisioningInfo,
- List layers,
- List excludedLayers,
- List featurePacks,
- boolean dryRun,
- Log log,
- Path deploymentContent,
- MavenRepoManager artifactResolver,
- Path outputFolder,
- GalleonBuilder pm,
- Map galleonOptions,
- String layersConfigurationFileName) throws Exception {
- if (!layers.isEmpty()) {
- throw new MojoExecutionException("layers must be empty when enabling glow");
- }
- if (!excludedLayers.isEmpty()) {
- throw new MojoExecutionException("excluded layers must be empty when enabling glow");
- }
- if (!Files.exists(deploymentContent) && !discoverProvisioningInfo.isIgnoreDeployment()) {
- throw new MojoExecutionException("A deployment is expected when enabling glow layer discovery");
- }
- if (discoverProvisioningInfo.isIgnoreDeployment()) {
- log.warn(
- "The deployment will be not analyzed, WildFly Glow will produce a server based on configured add-ons and the default base layer.");
- }
- Path inProvisioningFile = null;
- Path glowOutputFolder = outputFolder.resolve("glow-scan");
- Files.createDirectories(glowOutputFolder);
- if (!featurePacks.isEmpty()) {
- GalleonProvisioningConfig in = GalleonUtils.buildConfig(pm, featurePacks, layers, excludedLayers, galleonOptions,
- layersConfigurationFileName);
- inProvisioningFile = glowOutputFolder.resolve("glow-in-provisioning.xml");
- try (Provisioning p = pm.newProvisioningBuilder(in).build()) {
- p.storeProvisioningConfig(in, inProvisioningFile);
- }
- }
- Arguments arguments = discoverProvisioningInfo.toArguments(deploymentContent, inProvisioningFile,
- layersConfigurationFileName);
- log.info("Glow is scanning... ");
- ScanResults results;
- GlowMavenMessageWriter writer = new GlowMavenMessageWriter(log);
- try {
- results = GlowSession.scan(artifactResolver, arguments, writer);
- } catch (Exception ex) {
- throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
- }
-
- log.info("Glow scanning DONE.");
- try {
- results.outputInformation(writer);
- } catch (Exception ex) {
- results.close();
- throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
- }
- if (!dryRun) {
- results.outputConfig(glowOutputFolder, null);
- }
- if (results.getErrorSession().hasErrors()) {
- if (discoverProvisioningInfo.isFailsOnError()) {
- results.close();
- throw new MojoExecutionException("Error detected by WildFly Glow. Aborting.");
- } else {
- log.warn("Some erros have been identified, check logs.");
- }
- }
-
- return results;
- }
}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractAppDeployment.java b/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractAppDeployment.java
deleted file mode 100644
index bf3bcd61..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractAppDeployment.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.io.File;
-
-import org.apache.maven.plugins.annotations.Parameter;
-import org.wildfly.plugin.common.PropertyNames;
-
-/**
- * @author James R. Perkins
- */
-abstract class AbstractAppDeployment extends AbstractDeployment {
-
- /**
- * The target directory the application to be deployed is located.
- */
- @Parameter(defaultValue = "${project.build.directory}/", property = PropertyNames.DEPLOYMENT_TARGET_DIR)
- private File targetDir;
-
- /**
- * The file name of the application to be deployed.
- *
- * The {@code filename} property does have a default of ${project.build.finalName}.${project.packaging}
.
- * The default value is not injected as it normally would be due to packaging types like {@code ejb} that result in
- * a file with a {@code .jar} extension rather than an {@code .ejb} extension.
- *
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_FILENAME)
- private String filename;
-
- /**
- * By default certain package types are ignored when processing, e.g. {@code maven-project} and {@code pom}. Set
- * this value to {@code false} if this check should be bypassed.
- */
- @Parameter(alias = "check-packaging", property = PropertyNames.CHECK_PACKAGING, defaultValue = "true")
- private boolean checkPackaging;
-
- @Override
- protected boolean skipExecution() {
- boolean skip = super.skipExecution();
- if (!skip) {
- final PackageType packageType = PackageType.resolve(project);
- if (checkPackaging && packageType.isIgnored()) {
- getLog().debug(String.format("Ignoring packaging type %s.", packageType.getPackaging()));
- skip = true;
- }
- }
- return skip;
- }
-
- @Override
- protected File file() {
- final PackageType packageType = PackageType.resolve(project);
- final String filename;
- if (this.filename == null) {
- filename = String.format("%s.%s", project.getBuild().getFinalName(), packageType.getFileExtension());
- } else {
- filename = this.filename;
- }
- return new File(targetDir, filename);
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractDeployment.java b/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractDeployment.java
deleted file mode 100644
index dc28a9ea..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/AbstractDeployment.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.tools.ContainerDescription;
-import org.wildfly.plugin.tools.Deployment;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.DeploymentResult;
-
-/**
- * The default implementation for executing build plans on the server.
- *
- * @author James R. Perkins
- * @author Stuart Douglas
- */
-abstract class AbstractDeployment extends AbstractServerConnection {
-
- @Parameter(defaultValue = "${project}", readonly = true, required = true)
- protected MavenProject project;
-
- /**
- * The server groups the content should be deployed to.
- */
- @Parameter(alias = "server-groups", property = PropertyNames.SERVER_GROUPS)
- private List serverGroups;
-
- /**
- * Specifies the name used for the deployment.
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_NAME)
- private String name;
-
- /**
- * The runtime name for the deployment.
- *
- * In some cases users may wish to have two deployments with the same {@code runtime-name} (e.g. two versions of
- * {@code example.war}) both available in the management configuration, in which case the deployments would need to
- * have distinct {@code name} values but would have the same {@code runtime-name}.
- *
- */
- @Parameter(alias = "runtime-name", property = PropertyNames.DEPLOYMENT_RUNTIME_NAME)
- private String runtimeName;
-
- /**
- * Set to {@code true} if you want the deployment to be skipped, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- /**
- * The archive file.
- *
- * @return the archive file.
- */
- protected abstract File file();
-
- /**
- * The goal of the deployment.
- *
- * @return the goal of the deployment.
- */
- public abstract String goal();
-
- @Override
- public final void execute() throws MojoExecutionException, MojoFailureException {
- if (skipExecution()) {
- getLog().debug(String.format("Skipping deployment of %s:%s", project.getGroupId(), project.getArtifactId()));
- return;
- }
- try (
- ModelControllerClient client = createClient();
- MavenModelControllerClientConfiguration configuration = getClientConfiguration()) {
- final boolean isDomain = ContainerDescription.lookup(client).isDomain();
- validate(isDomain);
- // Deploy the deployment
- getLog().debug("Executing deployment");
-
- final Deployment deployment = configureDeployment(createDeployment());
-
- final DeploymentResult result = executeDeployment(DeploymentManager.Factory.create(client), deployment);
- if (!result.successful()) {
- throw new MojoExecutionException(
- String.format("Failed to execute goal %s: %s", goal(), result.getFailureMessage()));
- }
- } catch (IOException e) {
- throw new MojoFailureException(String.format("Failed to execute goal %s.", goal()), e);
- }
- }
-
- protected boolean skipExecution() {
- return skip;
- }
-
- protected abstract DeploymentResult executeDeployment(DeploymentManager deploymentManager, Deployment deployment)
- throws IOException, MojoDeploymentException;
-
- protected Deployment createDeployment() {
- return Deployment.of(file());
- }
-
- /**
- * Validates the deployment.
- *
- * @param isDomain {@code true} if this is a domain server, otherwise {@code false}
- *
- * @throws MojoDeploymentException if the deployment is invalid
- */
- protected void validate(final boolean isDomain) throws MojoDeploymentException {
- final boolean hasServerGroups = hasServerGroups();
- if (isDomain) {
- if (!hasServerGroups) {
- throw new MojoDeploymentException(
- "Server is running in domain mode, but no server groups have been defined.");
- }
- } else if (hasServerGroups) {
- throw new MojoDeploymentException("Server is running in standalone mode, but server groups have been defined.");
- }
- }
-
- private Deployment configureDeployment(final Deployment deployment) {
- return deployment.setName(name)
- .setRuntimeName(runtimeName)
- .addServerGroups(getServerGroups());
- }
-
- private Collection getServerGroups() {
- return serverGroups == null ? Collections.emptyList() : serverGroups;
- }
-
- private boolean hasServerGroups() {
- return serverGroups != null && !serverGroups.isEmpty();
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployArtifactMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/DeployArtifactMojo.java
deleted file mode 100644
index ddf51470..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployArtifactMojo.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Objects;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-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 an arbitrary artifact to the WildFly application server
- *
- * @author Stuart Douglas
- */
-@Mojo(name = "deploy-artifact", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
-public class DeployArtifactMojo extends AbstractDeployment {
-
- /**
- * The artifact to deploys groupId
- */
- @Parameter
- private String groupId;
-
- /**
- * The artifact to deploys artifactId
- */
- @Parameter
- private String artifactId;
-
- /**
- * The artifact to deploys classifier. Note that the classifier must also be set on the dependency being deployed.
- */
- @Parameter
- private String classifier;
-
- /**
- * 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;
-
- /**
- * The resolved dependency file
- */
- private File file;
-
- @Override
- public void validate(final boolean isDomain) throws MojoDeploymentException {
- super.validate(isDomain);
- if (artifactId == null) {
- throw new MojoDeploymentException("deploy-artifact must specify the artifactId");
- }
- if (groupId == null) {
- throw new MojoDeploymentException("deploy-artifact must specify the groupId");
- }
- final Set dependencies = project.getDependencyArtifacts();
- Artifact artifact = null;
- for (final Artifact a : dependencies) {
- if (Objects.equals(a.getArtifactId(), artifactId) &&
- Objects.equals(a.getGroupId(), groupId) &&
- Objects.equals(a.getClassifier(), classifier)) {
- artifact = a;
- break;
- }
- }
- if (artifact == null) {
- throw new MojoDeploymentException("Could not resolve artifact to deploy " + groupId + ":" + artifactId);
- }
- file = artifact.getFile();
- }
-
- @Override
- protected File file() {
- return file;
- }
-
- @Override
- public String goal() {
- return "deploy-artifact";
- }
-
- @Override
- protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment)
- throws IOException {
- if (force) {
- return deploymentManager.forceDeploy(deployment);
- }
- return deploymentManager.deploy(deployment);
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/DeployMojo.java
deleted file mode 100644
index fa0109de..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployMojo.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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);
- }
-
-}
\ No newline at end of file
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployOnlyMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/DeployOnlyMojo.java
deleted file mode 100644
index e333350e..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/DeployOnlyMojo.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.net.URL;
-
-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.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.tools.Deployment;
-
-/**
- * Deploys only the application to the WildFly Application Server without first invoking the
- * the execution of the lifecycle phase 'package' prior to executing itself.
- *
- * 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.
- */
-@Mojo(name = "deploy-only", threadSafe = true)
-@Execute(phase = LifecyclePhase.NONE)
-public class DeployOnlyMojo extends DeployMojo {
-
- /**
- * A URL representing the a path to the content to be deployed. The server the content is being deployed to will
- * require access to the URL.
- *
- * If defined this overrides the {@code filename} and {@code targetDir} configuration parameters.
- *
- */
- @Parameter(alias = "content-url", property = PropertyNames.DEPLOYMENT_CONTENT_URL)
- private URL contentUrl;
-
- @Override
- public String goal() {
- return "deploy-only";
- }
-
- @Override
- protected Deployment createDeployment() {
- if (contentUrl == null) {
- return super.createDeployment();
- }
- return Deployment.of(contentUrl);
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployMojo.java
deleted file mode 100644
index 1fd9be69..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployMojo.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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);
- }
-
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployOnlyMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployOnlyMojo.java
deleted file mode 100644
index 20ea1b24..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/RedeployOnlyMojo.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.net.URL;
-
-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.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.tools.Deployment;
-
-/**
- * Redeploys only the application to the WildFly Application Server without first invoking the
- * the execution of the lifecycle phase 'package' prior to executing itself.
- */
-@Mojo(name = "redeploy-only", threadSafe = true)
-@Execute(phase = LifecyclePhase.NONE)
-public class RedeployOnlyMojo extends RedeployMojo {
-
- /**
- * A URL representing the a path to the content to be redeployed. The server the content is being redeployed to will
- * require access to the URL.
- *
- * If defined this overrides the {@code filename} and {@code targetDir} configuration parameters.
- *
- */
- @Parameter(alias = "content-url", property = PropertyNames.DEPLOYMENT_CONTENT_URL)
- private URL contentUrl;
-
- @Override
- public String goal() {
- return "redeploy";
- }
-
- @Override
- protected Deployment createDeployment() {
- if (contentUrl == null) {
- return super.createDeployment();
- }
- return Deployment.of(contentUrl);
- }
-
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployArtifactMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployArtifactMojo.java
deleted file mode 100644
index 3cde9e13..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployArtifactMojo.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.DeploymentResult;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * Undeploys (removes) an arbitrary artifact to the WildFly application server
- *
- * @author James R. Perkins
- */
-@Mojo(name = "undeploy-artifact", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
-public class UndeployArtifactMojo extends AbstractServerConnection {
-
- @Parameter(defaultValue = "${project}", readonly = true, required = true)
- protected MavenProject project;
-
- /**
- * The artifact to deploys groupId
- */
- @Parameter
- private String groupId;
-
- /**
- * The artifact to deploys artifactId
- */
- @Parameter
- private String artifactId;
-
- /**
- * The artifact to deploys classifier. Note that the classifier must also be set on the dependency being deployed.
- */
- @Parameter
- private String classifier;
-
- /**
- * Specifies the name used for the deployment.
- *
- * The default name is derived from the {@code project.build.finalName} and the packaging type.
- *
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_NAME)
- private String name;
-
- /**
- * The server groups the content should be deployed to.
- */
- @Parameter(alias = "server-groups", property = PropertyNames.SERVER_GROUPS)
- private List serverGroups;
-
- /**
- * Indicates whether undeploy should ignore the undeploy operation if the deployment does not exist.
- */
- @Parameter(defaultValue = "true", property = PropertyNames.IGNORE_MISSING_DEPLOYMENT)
- private boolean ignoreMissingDeployment;
-
- /**
- * Set to {@code true} if you want the deployment to be skipped, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- getLog().debug(String.format("Skipping undeploy of artifact %s:%s", groupId, artifactId));
- return;
- }
- if (artifactId == null) {
- throw new MojoDeploymentException("undeploy-artifact must specify the artifactId");
- }
- if (groupId == null) {
- throw new MojoDeploymentException("undeploy-artifact must specify the groupId");
- }
- final String deploymentName;
- if (name == null) {
- final Set dependencies = project.getDependencyArtifacts();
- Artifact artifact = null;
- for (final Artifact a : dependencies) {
- if (Objects.equals(a.getArtifactId(), artifactId) &&
- Objects.equals(a.getGroupId(), groupId) &&
- Objects.equals(a.getClassifier(), classifier)) {
- artifact = a;
- break;
- }
- }
- if (artifact == null) {
- throw new MojoDeploymentException("Could not resolve artifact to deploy %s:%s", groupId, artifactId);
- }
- deploymentName = artifact.getFile().getName();
- } else {
- deploymentName = name;
- }
- final DeploymentResult result;
- try (
- ModelControllerClient client = createClient();
- MavenModelControllerClientConfiguration configuration = getClientConfiguration();) {
- final boolean failOnMissing = !ignoreMissingDeployment;
- final DeploymentManager deploymentManager = DeploymentManager.Factory.create(client);
- result = deploymentManager.undeploy(
- UndeployDescription.of(deploymentName).addServerGroups(getServerGroups()).setFailOnMissing(failOnMissing));
- } catch (IOException e) {
- throw new MojoFailureException(String.format("Failed to execute %s goal.", goal()), e);
- }
- if (!result.successful()) {
- throw new MojoDeploymentException("Failed to undeploy %s. Reason: %s", deploymentName, result.getFailureMessage());
- }
- }
-
- @Override
- public String goal() {
- return "undeploy-artifact";
- }
-
- private Collection getServerGroups() {
- return serverGroups == null ? Collections.emptyList() : serverGroups;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployMojo.java
deleted file mode 100644
index 3fb09057..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/UndeployMojo.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Pattern;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.tools.DeploymentDescription;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.DeploymentResult;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * Undeploys the application to the WildFly Application Server.
- *
- * @author James R. Perkins
- */
-@Mojo(name = "undeploy", threadSafe = true)
-public class UndeployMojo extends AbstractServerConnection {
-
- @Parameter(defaultValue = "${project}", readonly = true, required = true)
- private MavenProject project;
-
- /**
- * The server groups the content should be deployed to.
- */
- @Parameter(alias = "server-groups", property = PropertyNames.SERVER_GROUPS)
- private List serverGroups;
-
- /**
- * Specifies the name used for the deployment.
- *
- * The default name is derived from the {@code project.build.finalName} and the packaging type.
- *
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_NAME)
- private String name;
-
- /**
- * By default certain package types are ignored when processing, e.g. {@code maven-project} and {@code pom}. Set
- * this value to {@code false} if this check should be bypassed.
- */
- @Parameter(alias = "check-packaging", property = PropertyNames.CHECK_PACKAGING, defaultValue = "true")
- private boolean checkPackaging;
-
- /**
- * Specifies the name match pattern for undeploying/replacing artifacts.
- */
- @Parameter(alias = "match-pattern")
- private String matchPattern;
-
- /**
- * Specifies the strategy in case more than one matching artifact is found.
- *
- * - first: The first artifact is taken for undeployment/replacement. Other artifacts won't be touched.
- * The list of artifacts is sorted using the default collator.
- * - all: All matching artifacts are undeployed.
- * - fail: Deployment fails.
- *
- */
- @Parameter(alias = "match-pattern-strategy")
- private String matchPatternStrategy = MatchPatternStrategy.FAIL.toString();
-
- /**
- * Indicates whether undeploy should ignore the undeploy operation if the deployment does not exist.
- */
- @Parameter(defaultValue = "true", property = PropertyNames.IGNORE_MISSING_DEPLOYMENT)
- private boolean ignoreMissingDeployment;
-
- /**
- * Set to {@code true} if you want the deployment to be skipped, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- getLog().debug(String.format("Skipping undeploy of %s:%s", project.getGroupId(), project.getArtifactId()));
- return;
- }
- final PackageType packageType = PackageType.resolve(project);
- // Configure the name if it wasn't yet set
- if (name == null) {
- name = String.format("%s.%s", project.getBuild().getFinalName(), packageType.getFileExtension());
- }
- if (checkPackaging && packageType.isIgnored()) {
- getLog().debug(String.format("Ignoring packaging type %s.", packageType.getPackaging()));
- } else {
- final DeploymentResult result;
- try (
- ModelControllerClient client = createClient();
- MavenModelControllerClientConfiguration configuration = getClientConfiguration()) {
- final boolean failOnMissing = !ignoreMissingDeployment;
- final DeploymentManager deploymentManager = DeploymentManager.Factory.create(client);
- if (matchPattern == null) {
- result = deploymentManager.undeploy(
- UndeployDescription.of(name).addServerGroups(getServerGroups()).setFailOnMissing(failOnMissing));
- } else {
- final Set matchedDeployments = findDeployments(deploymentManager, failOnMissing);
- if (matchedDeployments.isEmpty()) {
- if (failOnMissing) {
- throw new MojoDeploymentException("No deployments matched the match-pattern %s.", matchPattern);
- }
- // nothing to undeploy
- return;
- }
- result = deploymentManager.undeploy(matchedDeployments);
- }
- } catch (IOException e) {
- throw new MojoFailureException("Failed to execute undeploy goal.", e);
- }
- if (!result.successful()) {
- throw new MojoDeploymentException("Failed to undeploy %s. Reason: %s", name, result.getFailureMessage());
- }
- }
- }
-
- @Override
- public String goal() {
- return "undeploy";
- }
-
- private Set findDeployments(final DeploymentManager deploymentManager, final boolean failOnMissing)
- throws IOException, MojoDeploymentException {
- if (name == null && matchPattern == null) {
- throw new IllegalArgumentException("deploymentName and matchPattern are null. One of them must "
- + "be set in order to find an existing deployment.");
- }
- final MatchPatternStrategy matchPatternStrategy = getMatchPatternStrategy();
-
- final Set matchedDeployments = new TreeSet<>();
- final Collection deployments = deploymentManager.getDeployments();
- final Pattern pattern = Pattern.compile(matchPattern);
- for (DeploymentDescription deployment : deployments) {
- boolean matchFound = false;
- final String deploymentName = deployment.getName();
- final Collection serverGroups = getServerGroups();
- if (pattern.matcher(deploymentName).matches()) {
- if (serverGroups.isEmpty()) {
- matchFound = true;
- matchedDeployments.add(UndeployDescription.of(deploymentName).setFailOnMissing(failOnMissing));
- } else {
- final UndeployDescription undeployDescription = UndeployDescription.of(deploymentName);
- for (String serverGroup : serverGroups) {
- if (deployment.getServerGroups().contains(serverGroup)) {
- matchFound = true;
- undeployDescription.addServerGroup(serverGroup);
- }
- }
- if (matchFound) {
- matchedDeployments.add(undeployDescription.setFailOnMissing(failOnMissing));
- }
- }
- if (matchFound && matchPatternStrategy == MatchPatternStrategy.FIRST) {
- break;
- }
- }
- }
- if (matchPatternStrategy == MatchPatternStrategy.FAIL && matchedDeployments.size() > 1) {
- throw new MojoDeploymentException("Deployment failed, found %d deployed artifacts for pattern '%s' (%s)",
- matchedDeployments.size(), matchPattern, matchedDeployments);
- }
- return matchedDeployments;
- }
-
- private MatchPatternStrategy getMatchPatternStrategy() {
- if (MatchPatternStrategy.FAIL.toString().equalsIgnoreCase(matchPatternStrategy)) {
- return MatchPatternStrategy.FAIL;
- } else if (MatchPatternStrategy.FIRST.toString().equalsIgnoreCase(matchPatternStrategy)) {
- return MatchPatternStrategy.FIRST;
- } else if (MatchPatternStrategy.ALL.toString().equalsIgnoreCase(matchPatternStrategy)) {
- return MatchPatternStrategy.ALL;
- }
- throw new IllegalStateException(
- String.format("matchPatternStrategy '%s' is not a valid strategy. Valid strategies are %s, %s and %s",
- matchPatternStrategy, MatchPatternStrategy.ALL, MatchPatternStrategy.FAIL, MatchPatternStrategy.FIRST));
- }
-
- private Collection getServerGroups() {
- return serverGroups == null ? Collections.emptyList() : serverGroups;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java b/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
deleted file mode 100644
index 378b33ca..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/deployment/resource/AddResourceMojo.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-package org.wildfly.plugin.deployment.resource;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.Operations.CompositeOperationBuilder;
-import org.jboss.dmr.ModelNode;
-import org.jboss.dmr.Property;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.MavenModelControllerClientConfiguration;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tools.ContainerDescription;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * Adds a resource
- *
- * If {@code force} is set to {@code false} and the resource has already been added to the server, an error will
- * occur and the operation will fail.
- *
- *
- * @author Stuart Douglas
- * @author James R. Perkins
- */
-@Mojo(name = "add-resource", threadSafe = true)
-public class AddResourceMojo extends AbstractServerConnection {
-
- public static final String GOAL = "add-resource";
-
- /**
- * The profiles where resources should be added to.
- */
- @Parameter(property = PropertyNames.PROFILES)
- private List profiles;
-
- /**
- * The operation address, as a comma separated string.
- *
- * If the resource or resources also define and address, this address will be used as the parent address. Meaning
- * the resource addresses will be prepended with this address.
- */
- @Parameter
- private String address;
-
- /**
- * A collection of resources to add.
- */
- @Parameter
- private Resource[] resources;
-
- /**
- * Specifies whether force mode should be used or not.
- *
- * If force mode is disabled, the add-resource goal will
- * cause a build failure if the resource is already present on the server.
- */
- @Parameter(defaultValue = "true", property = PropertyNames.ADD_RESOURCE_FORCE)
- private boolean force;
-
- /**
- * Set to {@code true} if you want this goal to be skipped, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- /**
- * The WildFly Application Server's home directory. This is not required, but should be used for commands such as
- * {@code module add} as they are executed on the local file system.
- */
- @Parameter(alias = "jboss-home", property = PropertyNames.JBOSS_HOME)
- private String jbossHome;
-
- @Override
- public String goal() {
- return GOAL;
- }
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- getLog().debug(String.format("Skipping add-resource with address %s", address));
- return;
- }
- // Validate the home directory if required
- if (jbossHome != null && !ServerManager.isValidHomeDirectory(jbossHome)) {
- throw new MojoFailureException("Invalid JBoss Home directory is not valid: " + jbossHome);
- }
- try (
- ModelControllerClient client = createClient();
- MavenModelControllerClientConfiguration configuration = getClientConfiguration();) {
- if (resources != null && resources.length > 0) {
- processResources(client, configuration, resources);
- } else {
- getLog().warn("No resources were provided.");
- }
- } catch (Exception e) {
- throw new MojoExecutionException(String.format("Could not execute goal %s. Reason: %s", goal(), e.getMessage()), e);
- }
- }
-
- private void processResources(final ModelControllerClient client,
- final MavenModelControllerClientConfiguration configuration, final Resource... resources) throws IOException {
- final Collection profiles = getProfiles();
- final boolean isDomain = ContainerDescription.lookup(client).isDomain();
- for (Resource resource : resources) {
- if (isDomain && profiles.isEmpty()) {
- throw new IllegalStateException("Cannot add resources when no profiles were defined.");
- }
- if (isDomain) {
- // Profiles are required when adding resources in domain mode
- if (profiles.isEmpty()) {
- throw new IllegalStateException("Cannot add resources when no profiles were defined.");
- }
- for (String profile : profiles) {
- final CompositeOperationBuilder compositeOperationBuilder = CompositeOperationBuilder.create();
- if (addCompositeResource(profile, client, resource, address, compositeOperationBuilder, true)) {
- // Execute the add resource operation
- reportFailure(client.execute(compositeOperationBuilder.build()));
- }
- }
- } else {
- final CompositeOperationBuilder compositeOperationBuilder = CompositeOperationBuilder.create();
- if (addCompositeResource(null, client, resource, address, compositeOperationBuilder, true)) {
- // Execute the add resource operation
- reportFailure(client.execute(compositeOperationBuilder.build()));
- }
- }
- }
- }
-
- private boolean addCompositeResource(final String profileName, final ModelControllerClient client, final Resource resource,
- final String parentAddress, final CompositeOperationBuilder compositeOp, final boolean checkExistence)
- throws IOException {
- final String inputAddress;
- if (parentAddress == null) {
- inputAddress = resource.getAddress();
- } else if (parentAddress.equals(resource.getAddress())) {
- inputAddress = resource.getAddress();
- } else if (resource.getAddress() == null) {
- inputAddress = parentAddress;
- } else {
- inputAddress = String.format("%s,%s", parentAddress, resource.getAddress());
- }
- // The address cannot be null
- if (inputAddress == null) {
- throw new RuntimeException("You must specify the address to add the resource to.");
- }
- final ModelNode address = parseAddress(profileName, inputAddress);
- if (checkExistence) {
- final boolean exists = resourceExists(address, client);
- if (resource.isAddIfAbsent() && exists) {
- return false;
- }
- if (exists && force) {
- reportFailure(client.execute(ServerOperations.createRemoveOperation(address, true)));
- } else if (exists) {
- throw new RuntimeException(String.format("Resource %s already exists.", address));
- }
- }
- compositeOp.addStep(buildAddOperation(address, resource.getProperties()));
- if (resource.getResources() != null) {
- final String resourceAddress = resource.getAddress();
- final String addr;
- if (parentAddress != null && resourceAddress != null) {
- addr = parentAddress + "," + resourceAddress;
- } else if (parentAddress != null) {
- addr = parentAddress;
- } else if (resourceAddress != null) {
- addr = resourceAddress;
- } else {
- addr = null;
- }
- for (Resource r : resource.getResources()) {
- addCompositeResource(profileName, client, r, addr, compositeOp, false);
- }
- }
- return true;
- }
-
- /**
- * Creates the operation to add a resource.
- *
- * @param address the address of the operation to add.
- * @param properties the properties to set for the resource.
- *
- * @return the operation.
- */
- private ModelNode buildAddOperation(final ModelNode address, final Map properties) {
- final ModelNode op = ServerOperations.createAddOperation(address);
- for (Map.Entry prop : properties.entrySet()) {
- final String[] props = prop.getKey().split(",");
- if (props.length == 0) {
- throw new RuntimeException("Invalid property " + prop);
- }
- ModelNode node = op;
- for (int i = 0; i < props.length - 1; ++i) {
- node = node.get(props[i]);
- }
- final String value = prop.getValue() == null ? "" : prop.getValue();
- if (value.startsWith("!!")) {
- handleDmrString(node, props[props.length - 1], value);
- } else {
- node.get(props[props.length - 1]).set(value);
- }
- }
- return op;
- }
-
- /**
- * Checks the existence of a resource. If the resource exists, {@code true} is returned, otherwise {@code false}.
- *
- * @param address the address of the resource to check.
- * @param client the client used to execute the operation.
- *
- * @return {@code true} if the resources exists, otherwise {@code false}.
- *
- * @throws IOException if an error occurs executing the operation.
- * @throws RuntimeException if the operation fails.
- */
- private boolean resourceExists(final ModelNode address, final ModelControllerClient client) throws IOException {
- final Property childAddress = ServerOperations.getChildAddress(address);
- final ModelNode parentAddress = ServerOperations.getParentAddress(address);
- final ModelNode r = client
- .execute(ServerOperations.createOperation(ServerOperations.READ_RESOURCE, parentAddress, false));
- reportFailure(r);
- boolean found = false;
- final String name = childAddress.getName();
- if (ServerOperations.isSuccessfulOutcome(r)) {
- final ModelNode resources = ServerOperations.readResult(r).get(name);
- if (resources.isDefined()) {
- for (ModelNode dataSource : resources.asList()) {
- if (dataSource.asProperty().getName().equals(childAddress.getValue().asString())) {
- found = true;
- }
- }
- }
- }
- return found;
- }
-
- /**
- * Handles DMR strings in the configuration
- *
- * @param node the node to create.
- * @param name the name for the node.
- * @param value the value for the node.
- */
- private void handleDmrString(final ModelNode node, final String name, final String value) {
- final String realValue = value.substring(2);
- node.get(name).set(ModelNode.fromString(realValue));
- }
-
- /**
- * Parses the comma delimited address into model nodes.
- *
- * @param profileName the profile name for the domain or {@code null} if not a domain
- * @param inputAddress the address.
- *
- * @return a collection of the address nodes.
- */
- private ModelNode parseAddress(final String profileName, final String inputAddress) {
- final ModelNode result = new ModelNode();
- if (profileName != null) {
- result.add(ServerOperations.PROFILE, profileName);
- }
- String[] parts = inputAddress.split(",");
- for (String part : parts) {
- String[] address = part.split("=");
- if (address.length != 2) {
- throw new RuntimeException(part + " is not a valid address segment");
- }
- result.add(address[0], address[1]);
- }
- return result;
- }
-
- private void reportFailure(final ModelNode result) {
- if (!ServerOperations.isSuccessfulOutcome(result)) {
- throw new RuntimeException(ServerOperations.getFailureDescriptionAsString(result));
- }
- }
-
- private Collection getProfiles() {
- return profiles == null ? Collections.emptyList() : profiles;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/dev/DevMojo.java b/plugin/src/main/java/org/wildfly/plugin/dev/DevMojo.java
deleted file mode 100644
index 43523520..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/dev/DevMojo.java
+++ /dev/null
@@ -1,1105 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.dev;
-
-import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
-import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
-import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
-import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.artifactId;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.configuration;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.executeMojo;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.executionEnvironment;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.groupId;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.plugin;
-import static org.twdata.maven.mojoexecutor.MojoExecutor.version;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.nio.file.ClosedWatchServiceException;
-import java.nio.file.FileSystems;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.WatchEvent;
-import java.nio.file.WatchKey;
-import java.nio.file.WatchService;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.nio.file.attribute.DosFileAttributes;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-import javax.inject.Inject;
-
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
-import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.BuildPluginManager;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugins.annotations.Component;
-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.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.galleon.ProvisioningException;
-import org.jboss.galleon.api.GalleonBuilder;
-import org.jboss.galleon.api.GalleonFeaturePack;
-import org.jboss.galleon.api.Provisioning;
-import org.jboss.galleon.api.ProvisioningBuilder;
-import org.jboss.galleon.api.config.GalleonProvisioningConfig;
-import org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager;
-import org.jboss.galleon.maven.plugin.util.MvnMessageWriter;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.jboss.galleon.util.IoUtils;
-import org.jboss.logging.Logger;
-import org.twdata.maven.mojoexecutor.MojoExecutor;
-import org.wildfly.channel.UnresolvedMavenArtifactException;
-import org.wildfly.core.launcher.CommandBuilder;
-import org.wildfly.glow.ScanResults;
-import org.wildfly.plugin.cli.CommandConfiguration;
-import org.wildfly.plugin.cli.CommandExecutor;
-import org.wildfly.plugin.common.Environment;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.Utils;
-import org.wildfly.plugin.core.MavenJBossLogger;
-import org.wildfly.plugin.deployment.PackageType;
-import org.wildfly.plugin.provision.ChannelConfiguration;
-import org.wildfly.plugin.provision.ChannelMavenArtifactRepositoryManager;
-import org.wildfly.plugin.provision.GlowConfig;
-import org.wildfly.plugin.server.AbstractServerStartMojo;
-import org.wildfly.plugin.server.ServerContext;
-import org.wildfly.plugin.server.ServerType;
-import org.wildfly.plugin.tools.ContainerDescription;
-import org.wildfly.plugin.tools.Deployment;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.DeploymentResult;
-import org.wildfly.plugin.tools.GalleonUtils;
-import org.wildfly.plugin.tools.PluginProgressTracker;
-import org.wildfly.plugin.tools.UndeployDescription;
-import org.wildfly.plugin.tools.VersionComparator;
-import org.wildfly.plugin.tools.server.ServerManager;
-import org.wildfly.plugin.tools.server.StandaloneManager;
-
-/**
- * Starts a standalone instance of WildFly and deploys the application to the server. The deployment type must be a WAR.
- * Once the server is running, the source directories are monitored for changes. If required the sources will be compiled
- * and the deployment may be redeployed.
- *
- *
- * Note that changes to the POM file are not monitored. If changes are made the POM file, the process will need to be
- * terminated and restarted.
- *
- *
- *
- * Note that if a WildFly Bootable JAR is packaged, it is ignored by this goal.
- *
- *
- * @author James R. Perkins
- * @since 4.1
- */
-@Mojo(name = "dev", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PACKAGE)
-public class DevMojo extends AbstractServerStartMojo {
- private static final String ORG_APACHE_MAVEN_PLUGINS = "org.apache.maven.plugins";
- private static final String MAVEN_COMPILER_PLUGIN = "maven-compiler-plugin";
- private static final String MAVEN_COMPILER_GOAL = "compile";
- private static final String MAVEN_WAR_PLUGIN = "maven-war-plugin";
- private static final String MAVEN_EXPLODED_GOAL = "exploded";
- private static final String MAVEN_WAR_GOAL = "war";
- private static final String MAVEN_RESOURCES_PLUGIN = "maven-resources-plugin";
- private static final String MAVEN_RESOURCES_GOAL = "resources";
-
- /**
- * Executing any one of these phases means the compile phase will have been run, if these have not been run we
- * manually run compile.
- */
- private static final Set POST_COMPILE_PHASES = Set.of(
- "compile",
- "process-classes",
- "generate-test-sources",
- "process-test-sources",
- "generate-test-resources",
- "process-test-resources",
- "test-compile",
- "process-test-classes",
- "test",
- "prepare-package",
- "package",
- "pre-integration-test",
- "integration-test",
- "post-integration-test",
- "verify",
- "install",
- "deploy");
-
- // A list of configuration parameters of the exploded goal as of 3.3.2
- private static final Map EXPLODED_WAR_PARAMETERS = Map.ofEntries(
- Map.entry("archive", ""),
- Map.entry("archiveClasses", "2.0.1"),
- Map.entry("containerConfigXML", ""),
- Map.entry("delimiters", "3.0.0"),
- Map.entry("dependentWarExcludes", ""),
- Map.entry("dependentWarIncludes", ""),
- Map.entry("escapeString", "2.1-beta-1"),
- Map.entry("escapedBackslashesInFilePath", "2.1-alpha-2"),
- // Only added to the exploded goal since 3.3.0, see
- // https://github.com/apache/maven-war-plugin/commit/d98aee4b2c0e58c89f610f4fa1c613861c4cdcd1
- Map.entry("failOnMissingWebXml", "3.3.0"),
- Map.entry("filteringDeploymentDescriptors", "2.1-alpha-2"),
- Map.entry("filters", ""),
- Map.entry("includeEmptyDirectories", "2.4"),
- Map.entry("nonFilteredFileExtensions", "2.1-alpha-2"),
- Map.entry("outdatedCheckPath", "3.3.1"),
- Map.entry("outputFileNameMapping", "2.1-alpha-1"),
- Map.entry("outputTimestamp", "3.3.0"),
- Map.entry("overlays", "2.1-alpha-1"),
- Map.entry("recompressZippedFiles", "2.3"),
- Map.entry("resourceEncoding", "2.3"),
- Map.entry("supportMultiLineFiltering", "2.4"),
- Map.entry("useDefaultDelimiters", "3.0.0"),
- Map.entry("useJvmChmod", "2.4"),
- Map.entry("warSourceDirectory", ""),
- Map.entry("warSourceExcludes", ""),
- Map.entry("warSourceIncludes", ""),
- Map.entry("webappDirectory", ""),
- Map.entry("webResources", ""),
- Map.entry("webXml", ""),
- Map.entry("workDirectory", ""));
-
- // A list of configuration parameters of the war goal as of 3.3.2
- private static final Map WAR_PARAMETERS = Map.ofEntries(
- Map.entry("archive", ""),
- Map.entry("archiveClasses", "2.0.1"),
- Map.entry("attachClasses", "2.1-alpha-2"),
- Map.entry("containerConfigXML", ""),
- Map.entry("classesClassifier", "2.1-alpha-2"),
- Map.entry("classifier", ""),
- Map.entry("delimiters", "3.0.0"),
- Map.entry("dependentWarExcludes", ""),
- Map.entry("dependentWarIncludes", ""),
- Map.entry("escapeString", "2.1-beta-1"),
- Map.entry("escapedBackslashesInFilePath", "2.1-alpha-2"),
- Map.entry("failOnMissingWebXml", "2.1-alpha-2"),
- Map.entry("filteringDeploymentDescriptors", "2.1-alpha-2"),
- Map.entry("filters", ""),
- Map.entry("includeEmptyDirectories", "2.4"),
- Map.entry("nonFilteredFileExtensions", "2.1-alpha-2"),
- Map.entry("outdatedCheckPath", ""),
- Map.entry("outputDirectory", "3.3.1"),
- Map.entry("outputFileNameMapping", "2.1-alpha-1"),
- Map.entry("outputTimestamp", "3.3.0"),
- Map.entry("packagingExcludes", "2.1-alpha-2"),
- Map.entry("packagingIncludes", "2.1-beta-1"),
- Map.entry("primaryArtifact", ""),
- Map.entry("overlays", "2.1-alpha-1"),
- Map.entry("recompressZippedFiles", "2.3"),
- Map.entry("resourceEncoding", "2.3"),
- Map.entry("supportMultiLineFiltering", "2.4"),
- Map.entry("useDefaultDelimiters", "3.0.0"),
- Map.entry("useJvmChmod", "2.4"),
- Map.entry("warSourceDirectory", ""),
- Map.entry("warSourceExcludes", ""),
- Map.entry("warSourceIncludes", ""),
- Map.entry("webappDirectory", ""),
- Map.entry("webResources", ""),
- Map.entry("webXml", ""),
- Map.entry("workDirectory", ""));
- private final Map watchedDirectories = new HashMap<>();
-
- @Component
- private BuildPluginManager pluginManager;
-
- @Inject
- private CommandExecutor commandExecutor;
-
- /**
- * The CLI commands to execute before the deployment is deployed.
- */
- @Parameter(property = PropertyNames.COMMANDS)
- private List commands = new ArrayList<>();
-
- /**
- * The CLI script files to execute before the deployment is deployed.
- */
- @Parameter(property = PropertyNames.SCRIPTS)
- private List scripts = new ArrayList<>();
-
- /**
- * The path to the server configuration to use.
- */
- @Parameter(alias = "server-config", property = PropertyNames.SERVER_CONFIG)
- private String serverConfig;
-
- /**
- * Additional extensions of files located in {@code src/webapp} directory and its sub-directories that don't
- * require a redeployment on update.
- *
- * The builtin list is {@code html, xhtml, jsp, js, css}.
- *
- *
- * You can set the system property {@code wildfly.dev.web.extensions} to a white space separated list of file
- * extensions.
- *
- */
- @Parameter(property = "wildfly.dev.web.extensions", alias = "web-extensions")
- private List webExtensions = new ArrayList<>();
-
- /**
- * File patterns that we should ignore during watch.
- *
- * Hidden files and files ending with '~' are ignored.
- *
- *
- * You can set the system property {@code wildfly.dev.ignore.patterns} to a white space separated list of file
- * patterns.
- *
- */
- @Parameter(property = "wildfly.dev.ignore.patterns", alias = "ignore-patterns")
- private List ignorePatterns = new ArrayList<>();
-
- /**
- * If set to {@code true} a server will not be provisioned or started and the application will be deployed to a
- * remote server.
- */
- @Parameter(property = "wildfly.dev.remote", defaultValue = "false")
- private boolean remote;
-
- /**
- * Arbitrary Galleon options used when provisioning the server. In case you
- * are building a large amount of server in the same maven session, it
- * is strongly advised to set 'jboss-fork-embedded' option to 'true' in
- * order to fork Galleon provisioning and CLI scripts execution in dedicated
- * processes. For example:
- *
- *
- * <galleon-options>
- * <jboss-fork-embedded>true</jboss-fork-embedded>
- * </galleon-options>
- *
- */
- @Parameter(alias = "galleon-options")
- private Map galleonOptions = Collections.emptyMap();
-
- /**
- * Whether to use offline mode when the plugin resolves an artifact. In
- * offline mode the plugin will only use the local Maven repository for an
- * artifact resolution.
- */
- @Parameter(alias = "offline-provisioning", defaultValue = "false", property = PropertyNames.WILDFLY_PROVISIONING_OFFLINE)
- private boolean offlineProvisioning;
-
- /**
- * Set to {@code true} if you want to delete the existing server referenced from the {@code provisioningDir} and provision a
- * new one,
- * otherwise {@code false}. When { @code discover-provisioning-info } is set to {@code true}, this option is enforced to be
- * {@code true}.
- * When discovery of Galleon provisioning information is enabled, a change to the application source code
- * could imply re-provisioning of the server.
- *
- * @since 5.0
- */
- @Parameter(alias = "overwrite-provisioned-server", defaultValue = "false", property = PropertyNames.WILDFLY_PROVISIONING_OVERWRITE_PROVISIONED_SERVER)
- private boolean overwriteProvisionedServer;
-
- /**
- * A list of feature-pack configurations to install, can be combined with layers. Use the System property
- * {@code wildfly.provisioning.feature-packs} to provide a comma separated list of feature-packs.
- */
- @Parameter(alias = "feature-packs", property = PropertyNames.WILDFLY_PROVISIONING_FEATURE_PACKS)
- private List featurePacks = Collections.emptyList();
-
- /**
- * A list of Galleon layers to provision. Can be used when feature-pack-location or feature-packs are set.
- * Use the System property {@code wildfly.provisioning.layers} to provide a comma separated list of layers.
- */
- @Parameter(alias = "layers", property = PropertyNames.WILDFLY_PROVISIONING_LAYERS)
- private List layers = Collections.emptyList();
-
- /**
- * A list of Galleon layers to exclude. Can be used when feature-pack-location or feature-packs are set.
- * Use the System property {@code wildfly.provisioning.layers.excluded} to provide a comma separated list of layers to
- * exclude.
- */
- @Parameter(alias = "excluded-layers", property = PropertyNames.WILDFLY_PROVISIONING_LAYERS_EXCLUDED)
- private List excludedLayers = Collections.emptyList();
-
- /**
- * A list of channels used for resolving artifacts while provisioning.
- *
- * Defining a channel:
- *
- *
- * <channels>
- * <channel>
- * <manifest>
- * <groupId>org.wildfly.channels</groupId>
- * <artifactId>wildfly-30.0</artifactId>
- * </manifest>
- * </channel>
- * <channel>
- * <manifest>
- * <url>https://example.example.org/channel/30</url>
- * </manifest>
- * </channel>
- * </channels>
- *
- *
- *
- * The {@code wildfly.channels} property can be used pass a comma delimited string for the channels. The channel
- * can be a URL or a Maven GAV. If a Maven GAV is used, the groupId and artifactId are required.
- *
- * Examples:
- *
- *
- * -Dwildfly.channels="https://channels.example.org/30"
- * -Dwildfly.channels="https://channels.example.org/30,org.example.channel:updates-30"
- * -Dwildfly.channels="https://channels.example.org/30,org.example.channel:updates-30:1.0.2"
- *
- *
- */
- @Parameter(property = PropertyNames.CHANNELS)
- private List channels;
-
- /**
- * Specifies the name used for the deployment.
- *
- * When the deployment is copied to the server, it is renamed with this name.
- *
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_NAME)
- private String name;
-
- /**
- * Galleon provisioning information discovery. This discovery only applies when the server is running locally.
- * NOTE: {@code overwriteProvisionedServer } must be set to true.
- *
- * @since 5.0
- */
- @Parameter(alias = "discover-provisioning-info")
- private GlowConfig discoverProvisioningInfo;
-
- // Lazily loaded list of patterns based on the ignorePatterns
- private final List ignoreUpdatePatterns = new ArrayList<>();
- // Lazy loaded
- private final Set allowedWarPluginParams = new HashSet<>();
-
- private String warGoal = MAVEN_EXPLODED_GOAL;
- private ScanResults results;
- private Path installDir;
- private boolean requiresWarDeletion;
- private Logger mavenJBossLogger;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- final var packageType = PackageType.resolve(project);
- if (!"war".equalsIgnoreCase(packageType.getPackaging())) {
- throw new MojoExecutionException("The dev goal only works for WAR deployments");
- }
- mavenJBossLogger = new MavenJBossLogger(getLog());
- serverConfig = serverConfig == null ? "standalone.xml" : serverConfig;
- ServerContext context = null;
- if (remote) {
- init();
- warGoal = MAVEN_WAR_GOAL;
- } else {
- if (isDiscoveryEnabled()) {
- if (!overwriteProvisionedServer) {
- overwriteProvisionedServer = true;
- getLog().info("Layer discovery has been enabled, overwriteProvisionedServer has been set to true");
- }
- } else {
- context = startServer(ServerType.STANDALONE);
- }
- }
- try {
- // Do we need to build first?
- if (needsCompile()) {
- triggerResources();
- triggerCompile();
- triggerWarGoal();
- } else {
- // First update will imply to delete the war and redeploy it.
- // in the remote case, we have a war and must keep it.
- requiresWarDeletion = !remote;
- }
- // We must start the server after compilation occurred to get a deployment to scan
- if (!remote && isDiscoveryEnabled()) {
- context = startServer(ServerType.STANDALONE);
- }
- try (final WatchService watcher = FileSystems.getDefault().newWatchService()) {
- final CompiledSourceHandler sourceHandler = new CompiledSourceHandler();
- registerDir(watcher, Path.of(project.getBuild().getSourceDirectory()), sourceHandler);
- for (Resource resource : project.getResources()) {
- registerDir(watcher, Path.of(resource.getDirectory()), new ResourceHandler());
- }
- registerDir(watcher, resolveWebAppSourceDir(), new WebAppResourceHandler(webExtensions));
- try (ModelControllerClient client = createClient()) {
- final StandaloneManager serverManager = ServerManager.builder().client(client).standalone();
- if (!serverManager.isRunning()) {
- throw new MojoExecutionException("No standalone server appears to be running.");
- }
- if (remote) {
- final ContainerDescription description = ContainerDescription.lookup(client);
- getLog().info(String.format("Deploying to remote %s container.", description));
- }
- // Execute commands before the deployment is done
- final CommandConfiguration.Builder builder = CommandConfiguration
- .of(this::createClient, this::getClientConfiguration)
- .addCommands(commands)
- .addScripts(scripts)
- .setStdout("none")
- .setAutoReload(false)
- .setTimeout(timeout);
- if (context == null) {
- builder.setOffline(false)
- .setFork(false);
- } else {
- builder.setJBossHome(context.jbossHome())
- .setFork(true);
- }
- commandExecutor.execute(builder.build(), mavenRepoManager);
- // Check the server state. We may need to restart the process, assuming we control the context
- if (context != null) {
- context = actOnServerState(client, context);
- }
-
- final DeploymentManager deploymentManager = serverManager.deploymentManager();
- final Deployment deployment = getDeploymentContent();
- try {
- final DeploymentResult result = deploymentManager.forceDeploy(deployment);
- if (!result.successful()) {
- throw new MojoExecutionException("Failed to deploy content: " + result.getFailureMessage());
- }
- if (remote) {
- getLog().info(String.format("Deployed %s", deployment));
- }
- watch(watcher, deploymentManager, deployment);
- } finally {
- deploymentManager.undeploy(UndeployDescription.of(deployment));
- serverManager.shutdown();
- }
- }
- } catch (IOException e) {
- throw new MojoExecutionException(e.getLocalizedMessage(), e);
- }
- } finally {
- if (context != null) {
- context.process().destroyForcibly();
- }
- }
- }
-
- @Override
- public String goal() {
- return "dev";
- }
-
- @Override
- protected MavenRepoManager createMavenRepoManager() throws MojoExecutionException {
- if (channels == null || channels.isEmpty()) {
- return offlineProvisioning ? new MavenArtifactRepositoryManager(repoSystem, session)
- : new MavenArtifactRepositoryManager(repoSystem, session, repositories);
- } else {
- try {
- return new ChannelMavenArtifactRepositoryManager(channels,
- repoSystem, session, repositories,
- getLog(), offlineProvisioning);
- } catch (MalformedURLException | UnresolvedMavenArtifactException ex) {
- throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
- }
- }
- }
-
- @Override
- protected CommandBuilder createCommandBuilder(final Path jbossHome) throws MojoExecutionException {
- return createStandaloneCommandBuilder(jbossHome, serverConfig);
- }
-
- /**
- * Allows the {@linkplain #webExtensions} to be set as a string.
- *
- * @param webExtensions a whitespace delimited string for the web file extensions
- */
- @SuppressWarnings("unused")
- public void setWebExtensions(final String webExtensions) {
- this.webExtensions = Utils.splitArguments(webExtensions);
- }
-
- /**
- * Allows the {@linkplain #ignorePatterns} to be set as a string.
- *
- * @param ignorePatterns a whitespace delimited string for the file patterns
- */
- @SuppressWarnings("unused")
- public void setIgnorePatterns(final String ignorePatterns) {
- this.ignorePatterns = Utils.splitArguments(ignorePatterns);
- }
-
- private boolean isDiscoveryEnabled() {
- return discoverProvisioningInfo != null;
- }
-
- GalleonProvisioningConfig shouldReprovision() {
- // Remote or no initial Glow scanning
- if (remote || results == null) {
- return null;
- }
- try {
- GalleonBuilder galleonBuilder = new GalleonBuilder();
- galleonBuilder.addArtifactResolver(mavenRepoManager);
- ScanResults newResults = scanDeployment(galleonBuilder);
- try {
- if (!results.getDecorators().equals(newResults.getDecorators())) {
- getLog().info("Set of discovered layers changed, needs to re-provision. New layers: "
- + newResults.getDecorators());
- return newResults.getProvisioningConfig();
- }
- if (!results.getExcludedLayers().equals(newResults.getExcludedLayers())) {
- getLog().info("Set of discovered excluded layers changed, needs to re-provision. New layers: "
- + newResults.getExcludedLayers());
- return newResults.getProvisioningConfig();
- }
- } finally {
- if (results != null) {
- results.close();
- }
- results = newResults;
- }
- } catch (Exception ex) {
- getLog().error(ex);
- }
- return null;
- }
-
- boolean reprovisionAndStart()
- throws IOException, InterruptedException, MojoExecutionException, MojoFailureException, ProvisioningException {
- GalleonProvisioningConfig newConfig = shouldReprovision();
- if (newConfig == null) {
- return false;
- }
- debug("Changes in layers detected, must re-provision the server");
- try (ModelControllerClient client = createClient()) {
- ServerManager.builder().client(client).standalone().shutdown();
- debug("Deleting existing installation " + installDir);
- IoUtils.recursiveDelete(installDir);
- }
- GalleonBuilder galleonBuilder = new GalleonBuilder();
- galleonBuilder.addArtifactResolver(mavenRepoManager);
- ProvisioningBuilder builder = galleonBuilder.newProvisioningBuilder(newConfig);
- try (Provisioning pm = builder
- .setInstallationHome(installDir)
- .setMessageWriter(new MvnMessageWriter(getLog()))
- .build()) {
- provisionServer(pm, newConfig);
- }
- startServer(ServerType.STANDALONE);
- return true;
- }
-
- @Override
- protected Path provisionIfRequired(final Path installDir) throws MojoFailureException, MojoExecutionException {
- // This is called for the initial start of the server.
- this.installDir = installDir;
- if (!overwriteProvisionedServer && Files.exists(installDir)) {
- getLog().info(String.format("A server already exists in %s, provisioning for %s:%s", installDir,
- project.getGroupId(), project.getArtifactId()));
- return installDir;
- }
- if (Files.exists(installDir)) {
- IoUtils.recursiveDelete(installDir);
- }
- try {
- GalleonBuilder provider = new GalleonBuilder();
- provider.addArtifactResolver(mavenRepoManager);
- GalleonProvisioningConfig config;
- if (featurePacks.isEmpty() && !isDiscoveryEnabled()) {
- return super.provisionIfRequired(installDir);
- } else {
- if (!isDiscoveryEnabled()) {
- config = GalleonUtils.buildConfig(provider, featurePacks, layers, excludedLayers, galleonOptions,
- serverConfig == null ? "standalone.xml" : serverConfig);
- } else {
- results = scanDeployment(provider);
- config = results.getProvisioningConfig();
- }
- }
- getLog().info("Provisioning server in " + installDir);
- try (Provisioning pm = provider.newProvisioningBuilder(config)
- .setInstallationHome(installDir)
- .setMessageWriter(new MvnMessageWriter(getLog()))
- .build()) {
- PluginProgressTracker.initTrackers(pm, mavenJBossLogger);
- pm.provision(config);
- // Check that at least the standalone or domain directories have been generated.
- if (Files.notExists(installDir.resolve("standalone")) && Files.notExists(installDir.resolve("domain"))) {
- getLog().error("Invalid galleon provisioning, no server provisioned in " + installDir + ". Make sure "
- + "that the list of Galleon feature-packs and Galleon layers are properly configured.");
- throw new MojoExecutionException("Invalid plugin configuration, no server provisioned.");
- }
- }
- } catch (Exception e) {
- throw new MojoFailureException(e.getLocalizedMessage(), e);
- }
- return installDir;
- }
-
- private ScanResults scanDeployment(GalleonBuilder pm) throws Exception {
- return Utils.scanDeployment(discoverProvisioningInfo,
- layers, excludedLayers, featurePacks, false,
- getLog(),
- resolveWarLocation(),
- mavenRepoManager,
- Paths.get(project.getBuild().getDirectory()),
- pm,
- galleonOptions,
- serverConfig);
- }
-
- private void provisionServer(Provisioning pm, GalleonProvisioningConfig config)
- throws ProvisioningException, MojoExecutionException {
- getLog().info("Provisioning server in " + installDir);
- PluginProgressTracker.initTrackers(pm, mavenJBossLogger);
- pm.provision(config);
- // Check that at least the standalone or domain directories have been generated.
- if (Files.notExists(installDir.resolve("standalone")) && Files.notExists(installDir.resolve("domain"))) {
- getLog().error("Invalid galleon provisioning, no server provisioned in " + installDir + ". Make sure "
- + "that the list of Galleon feature-packs and Galleon layers are properly configured.");
- throw new MojoExecutionException("Invalid plugin configuration, no server provisioned.");
- }
- }
-
- private boolean registerDir(final WatchService watcher, final Path dir, final WatchHandler handler) throws IOException {
- if (Files.exists(dir) && Files.isDirectory(dir)) {
- final int currentSize = watchedDirectories.size();
- final Set registered = watchedDirectories.values()
- .stream()
- .map(WatchContext::directory)
- .collect(Collectors.toCollection(HashSet::new));
- Files.walkFileTree(dir, new SimpleFileVisitor<>() {
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
- if (!project.getBuild().getOutputDirectory().equals(dir.toString())) {
- if (registered.add(dir)) {
- final WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
- watchedDirectories.put(key, WatchContext.of(dir, handler));
- debug("Watching for changes in %s", dir);
- }
- return FileVisitResult.CONTINUE;
- } else {
- return FileVisitResult.SKIP_SUBTREE;
- }
- }
- });
- return currentSize == watchedDirectories.size();
- }
- return false;
- }
-
- @SuppressWarnings("InfiniteLoopStatement")
- private void watch(final WatchService watcher, final DeploymentManager deploymentManager, final Deployment deployment) {
- final var projectDir = project.getBasedir().toPath();
- try {
- for (;;) {
- WatchKey key = watcher.take();
- for (WatchEvent> event : key.pollEvents()) {
- WatchEvent.Kind> kind = event.kind();
- if (kind == OVERFLOW) {
- continue;
- }
- @SuppressWarnings("unchecked")
- final WatchEvent ev = (WatchEvent) event;
- debug("File changed [%s]: %s", ev.kind().name(), ev.context());
- final Path absolutePath = getPath(key, ev.context());
- if (absolutePath == null) {
- continue;
- }
- final var eventPath = absolutePath.getFileName();
- try {
- if (isIgnoredChange(eventPath)) {
- debug("Ignoring change for %s", eventPath);
- continue;
- }
- } catch (IOException ex) {
- debug("Failed checking %s for ignored state: %s", eventPath, ex);
- }
- try {
- final var context = watchedDirectories.get(key);
- if (context == null) {
- getLog().warn(String.format("Failed to find context for %s", ev.context()));
- continue;
- }
- final var relativePath = projectDir.relativize(absolutePath);
- if (ev.kind() == ENTRY_DELETE) {
- // Undeploy application as Windows won't be able to delete the directory
- DeploymentResult deploymentResult = deploymentManager.undeploy(UndeployDescription.of(deployment));
- if (!deploymentResult.successful()) {
- getLog().warn(String.format(
- "Failed to undeploy application. Unexpected results may occur. Failure: %s",
- deploymentResult.getFailureMessage()));
- } else {
- // Clean the deployment directory if that is a first update and no compilation occured
- // meaning that is a war file, not an exploded directory.
- final Path path = resolveWarLocation();
- deleteRecursively(path);
- triggerResources();
- triggerCompile();
- triggerWarGoal();
- deploymentResult = deploymentManager.deploy(deployment);
- if (!deploymentResult.successful()) {
- throw new MojoExecutionException(
- "Failed to deploy content: " + deploymentResult.getFailureMessage());
- }
- if (Files.notExists(context.directory())) {
- watchedDirectories.remove(key);
- key.cancel();
- }
- continue;
- }
- } else if (ev.kind() == ENTRY_CREATE) {
- // If this is a directory we need to add the directory
- if (Files.isDirectory(eventPath)) {
- if (registerDir(watcher, eventPath, context.handler())) {
- debug("New directory registered: %s", relativePath);
- }
- } else {
- final Path parent = absolutePath.getParent();
- if (parent != null) {
- if (registerDir(watcher, parent, context.handler())) {
- debug("New directory registered: %s", relativePath);
- }
- }
- debug("A new source file has been created: %s", relativePath);
- }
- } else if (ev.kind() == ENTRY_MODIFY) {
- debug("Source file modified: %s", relativePath);
- }
- // Handle the file
- final var result = context.handle(ev, absolutePath);
- if (result.requiresRecompile()) {
- triggerCompile();
- }
- if (result.requiresCopyResources()) {
- triggerResources();
- }
- boolean repackaged = false;
- if (remote || result.requiresRepackage()) {
- // If !remote, the first packaging was not an exploded war, clean it.
- if (requiresWarDeletion) {
- final Path path = resolveWarLocation();
- DeploymentResult deploymentResult = deploymentManager
- .undeploy(UndeployDescription.of(deployment));
- if (!deploymentResult.successful()) {
- getLog().warn(String.format(
- "Failed to undeploy application. Unexpected results may occur. Failure: %s",
- deploymentResult.getFailureMessage()));
- }
- deleteRecursively(path);
- requiresWarDeletion = false;
- repackaged = true;
- }
- triggerWarGoal();
- }
- boolean reprovisioned = false;
- if (!remote) {
- reprovisioned = reprovisionAndStart();
- }
- if (remote || result.requiresRedeploy() || repackaged || reprovisioned) {
- final DeploymentResult deploymentResult;
- if (remote) {
- // If we are deploying an archive, we need to redeploy the full WAR
- deploymentResult = deploymentManager
- .redeploy(deployment);
- } else {
- if (reprovisioned || repackaged) {
- deploymentResult = deploymentManager
- .forceDeploy(deployment);
- } else {
- deploymentResult = deploymentManager
- .redeployToRuntime(deployment);
- }
- }
- if (!deploymentResult.successful()) {
- throw new MojoExecutionException(
- "Failed to deploy content: " + deploymentResult.getFailureMessage());
- }
- }
- } catch (Exception ex) {
- getLog().error("Exception handling file change: " + ex);
- }
- }
- key.reset();
- }
- } catch (ClosedWatchServiceException ex) {
- // OK Can ignore, we have been closed by shutdown hook.
- } catch (InterruptedException e) {
- throw new RuntimeException("Interrupted during watch.", e);
- }
- }
-
- private void triggerCompile() throws MojoExecutionException {
- // Compile the Java sources if needed
- final String compilerPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_COMPILER_PLUGIN;
- final Plugin compilerPlugin = project.getPlugin(compilerPluginKey);
- if (compilerPlugin != null) {
- executeGoal(project, compilerPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_COMPILER_PLUGIN, MAVEN_COMPILER_GOAL,
- getPluginConfig(compilerPlugin, MAVEN_COMPILER_GOAL));
- }
- }
-
- private void triggerWarGoal() throws MojoExecutionException {
- // Compile the Java sources if needed
- final String warPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_WAR_PLUGIN;
- final Plugin warPlugin = project.getPlugin(warPluginKey);
- if (warPlugin != null) {
- executeGoal(project, warPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_WAR_PLUGIN, warGoal,
- getWarPluginConfig(warPlugin));
- } else {
- getLog().warn("Can't package war application, war plugin not found");
- }
- }
-
- private void triggerResources() throws MojoExecutionException {
- List resources = project.getResources();
- if (resources.isEmpty()) {
- return;
- }
- Plugin resourcesPlugin = project.getPlugin(ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_RESOURCES_PLUGIN);
- if (resourcesPlugin == null) {
- return;
- }
- executeGoal(project, resourcesPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_RESOURCES_PLUGIN, MAVEN_RESOURCES_GOAL,
- getPluginConfig(resourcesPlugin, MAVEN_RESOURCES_GOAL));
- }
-
- private Path getPath(final WatchKey key, final Path fileName) {
- final WatchContext context = watchedDirectories.get(key);
- if (context == null) {
- getLog().debug("No more watching key, ignoring change done to " + fileName);
- return null;
- } else {
- final Path resolved = context.directory().resolve(fileName);
- // Fully ignore target dir
- if (Path.of(project.getBuild().getDirectory()).equals(resolved)) {
- return null;
- }
- return resolved;
- }
-
- }
-
- private boolean needsCompile() {
- // Check if compiling is going to be done by a previous goal
- boolean compileNeeded = true;
- for (String goal : mavenSession.getGoals()) {
- if (POST_COMPILE_PHASES.contains(goal)) {
- // The compile phase has happened before this goal. However, the parameter may have been
- // configured on the dev goal, but the may not have been overridden. If that
- // is the case, we need to compile again. We will log a message for informational purposes.
- compileNeeded = Files.notExists(resolveWarLocation());
- if (compileNeeded) {
- getLog().info(String.format(
- "The project builds finalName, \"%s\", does not match the configuration parameter of \"%s\". This will require the a second build.",
- resolveProjectDeploymentName(), name));
- }
- break;
- }
- if (goal.endsWith("wildfly:" + goal())) {
- break;
- }
- }
- return compileNeeded;
- }
-
- private void executeGoal(final MavenProject project, final Plugin plugin, final String groupId, final String artifactId,
- final String goal, final Xpp3Dom config) throws MojoExecutionException {
- executeMojo(plugin(groupId(groupId), artifactId(artifactId), version(plugin.getVersion()), plugin.getDependencies()),
- MojoExecutor.goal(goal), config, executionEnvironment(project, mavenSession, pluginManager));
- }
-
- private Xpp3Dom getPluginConfig(final Plugin plugin, final String goal) throws MojoExecutionException {
- Xpp3Dom mergedConfig = null;
- if (!plugin.getExecutions().isEmpty()) {
- for (PluginExecution exec : plugin.getExecutions()) {
- if (exec.getConfiguration() != null && exec.getGoals().contains(goal)) {
- mergedConfig = mergedConfig == null ? (Xpp3Dom) exec.getConfiguration()
- : Xpp3Dom.mergeXpp3Dom(mergedConfig, (Xpp3Dom) exec.getConfiguration(), true);
- }
- }
- }
-
- if (plugin.getConfiguration() != null) {
- mergedConfig = mergedConfig == null ? (Xpp3Dom) plugin.getConfiguration()
- : Xpp3Dom.mergeXpp3Dom(mergedConfig, (Xpp3Dom) plugin.getConfiguration(), true);
- }
-
- final Xpp3Dom configuration = configuration();
-
- if (mergedConfig != null) {
- Set supportedParams = null;
- // Filter out `test*` configurations
- for (Xpp3Dom child : mergedConfig.getChildren()) {
- if (child.getName().startsWith("test")) {
- continue;
- }
- if (supportedParams == null) {
- supportedParams = getMojoDescriptor(plugin, goal).getParameterMap().keySet();
- }
- if (supportedParams.contains(child.getName())) {
- configuration.addChild(child);
- }
- }
- }
-
- return configuration;
- }
-
- private Xpp3Dom getWarPluginConfig(final Plugin plugin) {
-
- final Xpp3Dom configuration = configuration();
-
- // Load the allowed configuration params if not yet loaded
- if (allowedWarPluginParams.isEmpty()) {
- final String pluginVersion = plugin.getVersion();
- final Map parameters = remote ? WAR_PARAMETERS : EXPLODED_WAR_PARAMETERS;
- allowedWarPluginParams.addAll(parameters.entrySet().stream()
- .filter(e -> e.getValue().isEmpty() || VersionComparator.compareVersion(e.getValue(), pluginVersion) <= 0)
- .map(Map.Entry::getKey)
- .collect(Collectors.toSet()));
- }
-
- final Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
- if (pluginConfiguration != null) {
- for (Xpp3Dom child : pluginConfiguration.getChildren()) {
- if (allowedWarPluginParams.contains(child.getName())) {
- configuration.addChild(child);
- }
- }
- }
-
- final MojoExecutor.Element e = new MojoExecutor.Element("webappDirectory",
- (remote ? resolveWarDir().toAbsolutePath().toString()
- : resolveWarLocation().toAbsolutePath()
- .toString()));
- configuration.addChild(e.toDom());
- return configuration;
- }
-
- // Required to retrieve the actual set of supported configuration items.
- private MojoDescriptor getMojoDescriptor(Plugin plugin, String goal) throws MojoExecutionException {
- try {
- return pluginManager.getMojoDescriptor(plugin, goal, repositories, session);
- } catch (Exception e) {
- throw new MojoExecutionException("Failed to obtain descriptor for Maven plugin " + plugin.getId() + " goal " + goal,
- e);
- }
- }
-
- private boolean isIgnoredChange(final Path file) throws IOException {
- if (isHiddenFile(file) || file.getFileName().toString().endsWith("~")) {
- return true;
- }
- for (Pattern pattern : getPatterns()) {
- if (pattern.matcher(file.getFileName().toString()).matches()) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isHiddenFile(final Path p) throws IOException {
- if (Environment.isWindows()) {
- final DosFileAttributes dosAttrs = Files.readAttributes(p, DosFileAttributes.class);
- return dosAttrs.isHidden();
- } else {
- return Files.isHidden(p);
- }
- }
-
- private List getPatterns() {
- if (!ignorePatterns.isEmpty()) {
- if (ignoreUpdatePatterns.isEmpty()) {
- for (String p : ignorePatterns) {
- Pattern pattern = Pattern.compile(p);
- ignoreUpdatePatterns.add(pattern);
- }
- }
- }
- return ignoreUpdatePatterns;
- }
-
- private Deployment getDeploymentContent() {
- return Deployment.of(resolveWarLocation());
- }
-
- private Path resolveWebAppSourceDir() {
- final String warPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_WAR_PLUGIN;
- final Plugin warPlugin = project.getPlugin(warPluginKey);
- Xpp3Dom dom = getWarPluginConfig(warPlugin);
- final Xpp3Dom warSourceDirectory = dom.getChild("warSourceDirectory");
- if (warSourceDirectory == null) {
- return project.getBasedir().toPath().resolve("src").resolve("main").resolve("webapp");
- }
- return Path.of(warSourceDirectory.getValue());
- }
-
- // The directory name also contains the extension, required for Glow scanning.
- private Path resolveWarLocation() {
- final String filename = resolveProjectDeploymentName();
- String runtimeName = this.name == null || this.name.isBlank() ? filename : this.name;
- return Path.of(project.getBuild().getDirectory()).resolve(runtimeName);
- }
-
- // In the case of remote deployment, WildFly Glow is not executed.
- // With the war goal, the directory doesn't contain the file extension.
- private Path resolveWarDir() {
- return Path.of(project.getBuild().getDirectory()).resolve(project.getBuild().getFinalName());
- }
-
- private String resolveProjectDeploymentName() {
- final PackageType packageType = PackageType.resolve(project);
- return String.format("%s.%s", project.getBuild()
- .getFinalName(), packageType.getFileExtension());
- }
-
- private void debug(final String format, final Object... args) {
- getLog().debug(String.format("[WATCH] " + format, args));
- }
-
- private static void deleteRecursively(final Path path) throws IOException {
- if (Files.isDirectory(path)) {
- Files.walkFileTree(path, new SimpleFileVisitor<>() {
-
- @Override
- public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
- Files.delete(file);
- return FileVisitResult.CONTINUE;
- }
-
- @Override
- public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException {
- Files.delete(dir);
- return FileVisitResult.CONTINUE;
- }
- });
- } else if (Files.exists(path)) {
- Files.delete(path);
- }
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/provision/AbstractProvisionServerMojo.java b/plugin/src/main/java/org/wildfly/plugin/provision/AbstractProvisionServerMojo.java
index fbc02041..a75e5b61 100644
--- a/plugin/src/main/java/org/wildfly/plugin/provision/AbstractProvisionServerMojo.java
+++ b/plugin/src/main/java/org/wildfly/plugin/provision/AbstractProvisionServerMojo.java
@@ -214,15 +214,6 @@ abstract class AbstractProvisionServerMojo extends AbstractMojo {
@Parameter(alias = "channels", property = PropertyNames.CHANNELS)
List channels;
- /**
- * Do not actually provision a server but generate the Galleon provisioning configuration
- * in {@code target/.wildfly-maven-plugin-provisioning.xml} file.
- *
- * @since 5.0
- */
- @Parameter(alias = "dry-run")
- boolean dryRun;
-
private Path wildflyDir;
protected MavenRepoManager artifactResolver;
@@ -233,9 +224,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().debug(String.format("Skipping " + getGoal() + " of %s:%s", project.getGroupId(), project.getArtifactId()));
return;
}
- if (dryRun) {
- getLog().info("Dry run execution, no server will be provisioned.");
- }
Path targetPath = Paths.get(project.getBuild().getDirectory());
wildflyDir = targetPath.resolve(provisioningDir).normalize();
if (!overwriteProvisionedServer && Files.exists(wildflyDir)) {
@@ -264,12 +252,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
try {
try {
provisionServer(wildflyDir);
- if (!dryRun) {
- if (artifactResolver instanceof ChannelMavenArtifactRepositoryManager) {
- ((ChannelMavenArtifactRepositoryManager) artifactResolver).done(wildflyDir);
- }
- serverProvisioned(wildflyDir);
+ if (artifactResolver instanceof ChannelMavenArtifactRepositoryManager) {
+ ((ChannelMavenArtifactRepositoryManager) artifactResolver).done(wildflyDir);
}
+ serverProvisioned(wildflyDir);
} catch (ProvisioningException | IOException | XMLStreamException ex) {
throw new MojoExecutionException("Provisioning failed", ex);
}
@@ -301,13 +287,6 @@ private void provisionServer(Path home) throws ProvisioningException,
.setLogTime(logProvisioningTime)
.setRecordState(recordProvisioningState)
.build()) {
- if (dryRun) {
- Path targetPath = Paths.get(project.getBuild().getDirectory());
- Path file = targetPath.resolve(PLUGIN_PROVISIONING_FILE);
- getLog().info("Dry-run execution, generating provisioning.xml file: " + file);
- pm.storeProvisioningConfig(config, file);
- return;
- }
getLog().info("Provisioning server in " + home);
PluginProgressTracker.initTrackers(pm, new MavenJBossLogger(getLog()));
pm.provision(config);
diff --git a/plugin/src/main/java/org/wildfly/plugin/provision/ApplicationImageMojo.java b/plugin/src/main/java/org/wildfly/plugin/provision/ApplicationImageMojo.java
index 7a52bdb3..c14e5923 100644
--- a/plugin/src/main/java/org/wildfly/plugin/provision/ApplicationImageMojo.java
+++ b/plugin/src/main/java/org/wildfly/plugin/provision/ApplicationImageMojo.java
@@ -21,10 +21,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-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.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
@@ -47,7 +44,8 @@
*
* @since 4.0
*/
-@Mojo(name = "image", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PACKAGE)
+// @Mojo(name = "image", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase =
+// LifecyclePhase.PACKAGE)
@SuppressWarnings({ "deprecated", "removal" })
public class ApplicationImageMojo extends PackageServerMojo {
diff --git a/plugin/src/main/java/org/wildfly/plugin/provision/GlowConfig.java b/plugin/src/main/java/org/wildfly/plugin/provision/GlowConfig.java
deleted file mode 100644
index 67716747..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/provision/GlowConfig.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-package org.wildfly.plugin.provision;
-
-import java.nio.file.Path;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.wildfly.glow.Arguments;
-import org.wildfly.glow.OutputFormat;
-import org.wildfly.glow.ScanArguments.Builder;
-
-/**
- *
- * @author jdenise
- */
-@SuppressWarnings("unused")
-public class GlowConfig {
-
- static final String CLOUD_CONTEXT = "cloud";
-
- private String context = "bare-metal";
- private String profile;
- private Set addOns = Set.of();
- private String version;
- private boolean suggest;
- private Set layersForJndi = Set.of();
- private Set excludedArchives = Set.of();
- private boolean failsOnError = true;
- private boolean preview;
- private boolean verbose;
- private boolean ignoreDeployment;
-
- public GlowConfig() {
- }
-
- public Arguments toArguments(Path deployment, Path inProvisioning, String layersConfigurationFileName) {
- final Set profiles = profile != null ? Set.of(profile) : Set.of();
- List lst = ignoreDeployment ? Collections.emptyList() : List.of(deployment);
- Builder builder = Arguments.scanBuilder().setExecutionContext(context).setExecutionProfiles(profiles)
- .setUserEnabledAddOns(addOns).setBinaries(lst).setSuggest(suggest).setJndiLayers(getLayersForJndi())
- .setVersion(version)
- .setTechPreview(preview)
- .setExcludeArchivesFromScan(excludedArchives)
- .setVerbose(verbose)
- .setOutput(OutputFormat.PROVISIONING_XML);
- if (inProvisioning != null) {
- builder.setProvisoningXML(inProvisioning);
- }
- if (layersConfigurationFileName != null) {
- builder.setConfigName(layersConfigurationFileName);
- }
- return builder.build();
- }
-
- /**
- * @return the execution context
- */
- public String getContext() {
- return context;
- }
-
- /**
- * @param context the execution context to set
- */
- public void setContext(String context) {
- this.context = context;
- }
-
- /**
- * @return the profile
- */
- public String getProfile() {
- return profile;
- }
-
- /**
- * @param profile the profile to set
- */
- public void setProfile(String profile) {
- this.profile = profile;
- }
-
- /**
- * @return the userEnabledAddOns
- */
- public Set getAddOns() {
- return addOns;
- }
-
- /**
- * @param addOns the userEnabledAddOns to set
- */
- public void setAddOns(Set addOns) {
- this.addOns = Set.copyOf(addOns);
- }
-
- /**
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * @param version the version to set
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * @return the suggest
- */
- public boolean isSuggest() {
- return suggest;
- }
-
- /**
- * @param suggest the suggest to set
- */
- public void setSuggest(boolean suggest) {
- this.suggest = suggest;
- }
-
- /**
- * @return the layersForJndi
- */
- public Set getLayersForJndi() {
- return layersForJndi;
- }
-
- /**
- * @param layersForJndi the layersForJndi to set
- */
- public void setLayersForJndi(Set layersForJndi) {
- this.layersForJndi = Set.copyOf(layersForJndi);
- }
-
- /**
- * @return the failsOnError
- */
- public boolean isFailsOnError() {
- return failsOnError;
- }
-
- /**
- * @param failsOnError the failsOnError to set
- */
- public void setFailsOnError(boolean failsOnError) {
- this.failsOnError = failsOnError;
- }
-
- /**
- * @param preview the preview to set
- */
- public void setPreview(boolean preview) {
- this.preview = preview;
- }
-
- /**
- * @return the preview
- */
- public boolean isPreview() {
- return preview;
- }
-
- /**
- * @return the excludedArchives
- */
- public Set getExcludedArchives() {
- return excludedArchives;
- }
-
- /**
- * @param excludedArchives the excludedArchives to set
- */
- public void setExcludedArchives(Set excludedArchives) {
- this.excludedArchives = Set.copyOf(excludedArchives);
- }
-
- /**
- * @param verbose the verbose to set
- */
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- /**
- * @return the verbose
- */
- public boolean isVerbose() {
- return verbose;
- }
-
- /**
- * @param ignoreDeployment the ignoreDeployment to set
- */
- public void setIgnoreDeployment(boolean ignoreDeployment) {
- this.ignoreDeployment = ignoreDeployment;
- }
-
- /**
- * @return the ignoreDeployment
- */
- public boolean isIgnoreDeployment() {
- return ignoreDeployment;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java b/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java
index 9d1904fb..4a9dc9ff 100644
--- a/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java
+++ b/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java
@@ -32,13 +32,11 @@
import org.jboss.galleon.api.config.GalleonProvisioningConfig;
import org.jboss.galleon.maven.plugin.util.MvnMessageWriter;
import org.jboss.galleon.util.IoUtils;
-import org.wildfly.glow.ScanResults;
import org.wildfly.plugin.cli.BaseCommandConfiguration;
import org.wildfly.plugin.cli.CliSession;
import org.wildfly.plugin.cli.OfflineCommandExecutor;
import org.wildfly.plugin.common.PropertyNames;
import org.wildfly.plugin.common.StandardOutput;
-import org.wildfly.plugin.common.Utils;
import org.wildfly.plugin.deployment.MojoDeploymentException;
import org.wildfly.plugin.deployment.PackageType;
import org.wildfly.plugin.tools.bootablejar.BootableJarSupport;
@@ -177,61 +175,6 @@ public class PackageServerMojo extends AbstractProvisionServerMojo {
@Parameter(defaultValue = "false", property = PropertyNames.SKIP_PACKAGE_DEPLOYMENT)
protected boolean skipDeployment;
- /**
- * Galleon provisioning info discovery.
- *
- * By enabling this feature, the set of Galleon feature-packs
- * and layers are automatically discovered by scanning the deployed application.
- * You can configure the following items:
- *
- *
- *
- * - addOns: List of addOn to enable. An addOn brings extra galleon layers to the provisioning (eg: {@code wildfly-cli} to
- * include CLI.
- * - context: {@code bare-metal} or {@code cloud}. Default to {@code bare-metal}. Note that if the context is set to
- * {@code cloud}
- * and the plugin option {@code bootable-jar} is set, the plugin execution will abort.
- * - failsOnError: true|false. If errors are detected (missing datasource, missing messaging broker, ambiguous JNDI call,
- * provisioning is aborted. Default to {@code false}
- * - layersForJndi: List of Galleon layers required by some JNDI calls located in your application.
- * - preview: {@code true} | {@code false}. Use preview feature-packs. Default to {@code false}.
- * - profile: {@code ha}. Default being non ha server configuration.
- * - suggest: {@code true} | {@code false}. Display addOns that you can use to enhance discovered provisioning
- * configuration. Default to {@code false}.
- * - excludedArchives: List of archives contained in the deployment to exclude when scanning.
- * Wildcards ({@code *}) are allowed. N.B. Just the name of the archive is matched, do not attempt
- * to specify a full path within the jar. The following examples would be valid exclusions: {@code my-jar.jar},
- * {@code *-internal.rar}.
- * - verbose: {@code true} | {@code false}. Display more information. The set of rules that selected Galleon layers are
- * printed. Default to {@code false}.
- * - version: server version. Default being the latest released version.
- * - ignoreDeployment: The deployment will be not analyzed. A server based on the configured add-ons and the default base
- * layer is provisioned. Default to {@code false}.
- *
- *
- *
- *
- * For example, cloud, ha profile with CLI and openapi addOns enabled. mail layer being explicitly included:
- *
- *
- * <discover-provisioning-info>
- * <context>cloud</context>
- * <profile>ha</profile>
- * <addOns>
- * <addOn>wildfly-cli</addOn>
- * <addOn>openapi</addOn>
- * </addOns>
- * <layersForJndi>
- * <layer>mail</layer>
- * </layersForJndi>
- * </discover-provisioning-info>
- *
- *
- * @since 5.0
- */
- @Parameter(alias = "discover-provisioning-info")
- private GlowConfig discoverProvisioningInfo;
-
/**
* Package the provisioned server into a WildFly Bootable JAR. In order to produce a hollow jar (a jar that doesn't contain
* a deployment) set the { @code skipDeployment } parameter. A server packaged as bootable JAR is suited to run on
@@ -281,35 +224,8 @@ protected GalleonProvisioningConfig getDefaultConfig() throws ProvisioningExcept
@Override
protected GalleonProvisioningConfig buildGalleonConfig(GalleonBuilder pm)
throws MojoExecutionException, ProvisioningException {
- if (discoverProvisioningInfo == null) {
- config = super.buildGalleonConfig(pm);
- return config;
- }
- if (discoverProvisioningInfo.getContext() != null &&
- GlowConfig.CLOUD_CONTEXT.equals(discoverProvisioningInfo.getContext()) &&
- bootableJar) {
- throw new MojoExecutionException("The option 'bootableJar' must not be set when "
- + "discovering provisioning information for the 'cloud' execution context.");
- }
- try {
- try (ScanResults results = Utils.scanDeployment(discoverProvisioningInfo,
- layers,
- excludedLayers,
- featurePacks,
- dryRun,
- getLog(),
- getDeploymentContent(),
- artifactResolver,
- Paths.get(project.getBuild().getDirectory()),
- pm,
- galleonOptions,
- layersConfigurationFileName)) {
- config = results.getProvisioningConfig();
- return config;
- }
- } catch (Exception ex) {
- throw new MojoExecutionException(ex.getLocalizedMessage(), ex);
- }
+ config = super.buildGalleonConfig(pm);
+ return config;
}
@Override
@@ -539,4 +455,8 @@ private static void cleanupServer(Path jbossHome) throws IOException {
IoUtils.recursiveDelete(log);
}
+ @Override
+ protected void enrichRepositories() throws MojoExecutionException {
+ // NO-OP
+ }
}
\ No newline at end of file
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/AbstractServerStartMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/AbstractServerStartMojo.java
deleted file mode 100644
index 7239333c..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/AbstractServerStartMojo.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.jboss.galleon.ProvisioningException;
-import org.wildfly.core.launcher.DomainCommandBuilder;
-import org.wildfly.core.launcher.StandaloneCommandBuilder;
-import org.wildfly.plugin.common.Environment;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.Utils;
-import org.wildfly.plugin.tools.GalleonUtils;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * @author James R. Perkins
- */
-public abstract class AbstractServerStartMojo extends AbstractStartMojo {
-
- /**
- * The target directory the application to be deployed is located.
- */
- @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true)
- protected File targetDir;
-
- /**
- * The WildFly Application Server's home directory. If not used, WildFly will be downloaded.
- */
- @Parameter(alias = "jboss-home", property = PropertyNames.JBOSS_HOME)
- protected String jbossHome;
-
- /**
- * The feature pack location. See the documentation
- * for details on how to format a feature pack location.
- *
- * Note that if you define the version in the feature pack location, e.g. {@code #26.1.1.Final}, the {@code version}
- * configuration parameter should be left blank.
- *
- */
- @Parameter(alias = "feature-pack-location", property = PropertyNames.WILDFLY_FEATURE_PACK_LOCATION)
- private String featurePackLocation;
-
- /**
- * The version of the WildFly default server to install in case no jboss-home has been set
- * and no server has previously been provisioned.
- *
- * The latest stable version is resolved if left blank.
- *
- */
- @Parameter(property = PropertyNames.WILDFLY_VERSION)
- private String version;
-
- /**
- * The directory name inside the buildDir where to provision the default server.
- * By default the server is provisioned into the 'server' directory.
- *
- * @since 3.0
- */
- @Parameter(alias = "provisioning-dir", property = PropertyNames.WILDFLY_PROVISIONING_DIR, defaultValue = Utils.WILDFLY_DEFAULT_DIR)
- private String provisioningDir;
-
- /**
- * The modules path or paths to use. A single path can be used or multiple paths by enclosing them in a paths
- * element.
- */
- @Parameter(alias = "modules-path", property = PropertyNames.MODULES_PATH)
- private ModulesPath modulesPath;
-
- /**
- * Options passed to JBoss Modules. This is useful for things like Java Agents where you need to start the server
- * with an agent.
- */
- @Parameter(alias = "module-options", property = PropertyNames.MODULE_OPTS)
- protected String[] moduleOptions;
-
- /**
- * The users to add to the server.
- */
- @Parameter(alias = "add-user", property = "wildfly.add-user")
- private AddUser addUser;
-
- @Override
- protected Path getServerHome() throws MojoExecutionException, MojoFailureException {
- // Validate the environment
- final Path jbossHome = provisionIfRequired(targetDir.toPath().resolve(provisioningDir));
- if (!ServerManager.isValidHomeDirectory(jbossHome)) {
- throw new MojoExecutionException(String.format("JBOSS_HOME '%s' is not a valid directory.", jbossHome));
- }
- return jbossHome;
- }
-
- /**
- * Allows the {@link #moduleOptions} to be set as a string. The string is assumed to be space delimited.
- *
- * @param value a spaced delimited value of JBoss Modules options
- */
- @SuppressWarnings("unused")
- public void setModulesOptions(final String value) {
- if (value != null) {
- moduleOptions = value.split("\\s+");
- }
- }
-
- protected StandaloneCommandBuilder createStandaloneCommandBuilder(final Path jbossHome, final String serverConfig)
- throws MojoExecutionException {
- final StandaloneCommandBuilder commandBuilder = StandaloneCommandBuilder.of(jbossHome)
- .setJavaHome(javaHome)
- .addModuleDirs(modulesPath.getModulePaths());
-
- // Set the JVM options
- if (Utils.isNotNullOrEmpty(javaOpts)) {
- commandBuilder.setJavaOptions(javaOpts);
- }
- if (debug) {
- commandBuilder.addJavaOptions(String.format("-agentlib:jdwp=transport=dt_socket,server=y,suspend=%s,address=%s:%d",
- debugSuspend ? "y" : "n", debugHost, debugPort));
- }
-
- if (serverConfig != null) {
- commandBuilder.setServerConfiguration(serverConfig);
- }
-
- if (propertiesFile != null) {
- commandBuilder.setPropertiesFile(propertiesFile);
- }
-
- if (serverArgs != null) {
- commandBuilder.addServerArguments(serverArgs);
- }
-
- if (Utils.isNotNullOrEmpty(moduleOptions)) {
- commandBuilder.setModuleOptions(moduleOptions);
- }
-
- final Path javaHomePath = (this.javaHome == null ? Paths.get(System.getProperty("java.home"))
- : Paths.get(this.javaHome));
- if (Environment.isModularJvm(javaHomePath)) {
- commandBuilder.addJavaOptions(Environment.getModularJvmArguments());
- }
-
- // Print some server information
- final Log log = getLog();
- log.info("JAVA_HOME : " + commandBuilder.getJavaHome());
- log.info("JBOSS_HOME: " + commandBuilder.getWildFlyHome());
- log.info("JAVA_OPTS : " + Utils.toString(commandBuilder.getJavaOptions(), " "));
- try {
- addUsers(commandBuilder.getWildFlyHome(), commandBuilder.getJavaHome());
- } catch (IOException e) {
- throw new MojoExecutionException("Failed to add users", e);
- }
- return commandBuilder;
- }
-
- protected DomainCommandBuilder createDomainCommandBuilder(final Path jbossHome, final String domainConfig,
- final String hostConfig) throws MojoExecutionException {
- final Path javaHome = (this.javaHome == null ? Paths.get(System.getProperty("java.home")) : Paths.get(this.javaHome));
- final DomainCommandBuilder commandBuilder = DomainCommandBuilder.of(jbossHome, javaHome)
- .addModuleDirs(modulesPath.getModulePaths());
-
- // Set the JVM options
- if (Utils.isNotNullOrEmpty(javaOpts)) {
- commandBuilder.setProcessControllerJavaOptions(javaOpts)
- .setHostControllerJavaOptions(javaOpts);
- }
-
- if (domainConfig != null) {
- commandBuilder.setDomainConfiguration(domainConfig);
- }
-
- if (hostConfig != null) {
- commandBuilder.setHostConfiguration(hostConfig);
- }
-
- if (propertiesFile != null) {
- commandBuilder.setPropertiesFile(propertiesFile);
- }
-
- if (serverArgs != null) {
- commandBuilder.addServerArguments(serverArgs);
- }
-
- // Workaround for WFCORE-4121
- if (Environment.isModularJvm(javaHome)) {
- commandBuilder.addHostControllerJavaOptions(Environment.getModularJvmArguments());
- commandBuilder.addProcessControllerJavaOptions(Environment.getModularJvmArguments());
- }
-
- // Print some server information
- final Log log = getLog();
- log.info("JAVA_HOME : " + commandBuilder.getJavaHome());
- log.info("JBOSS_HOME: " + commandBuilder.getWildFlyHome());
- log.info("JAVA_OPTS : " + Utils.toString(commandBuilder.getHostControllerJavaOptions(), " "));
- try {
- addUsers(commandBuilder.getWildFlyHome(), commandBuilder.getJavaHome());
- } catch (IOException e) {
- throw new MojoExecutionException("Failed to add users", e);
- }
- return commandBuilder;
- }
-
- protected Path provisionIfRequired(final Path installDir) throws MojoFailureException, MojoExecutionException {
- if (jbossHome != null) {
- // we do not need to download WildFly
- return Paths.get(jbossHome);
- }
- try {
- if (!Files.exists(installDir)) {
- getLog().info("Provisioning default server in " + installDir);
- GalleonUtils.provision(installDir, resolveFeaturePackLocation(), version, mavenRepoManager);
- }
- return installDir;
- } catch (ProvisioningException ex) {
- throw new MojoFailureException(ex.getLocalizedMessage(), ex);
- }
- }
-
- private void addUsers(final Path wildflyHome, final Path javaHome) throws IOException {
- if (addUser != null && addUser.hasUsers()) {
- getLog().info("Adding users: " + addUser);
- addUser.addUsers(wildflyHome, javaHome);
- }
- }
-
- private String resolveFeaturePackLocation() {
- return featurePackLocation == null ? getDefaultFeaturePackLocation() : featurePackLocation;
- }
-
- /**
- * Returns the default feature pack location if not defined in the configuration.
- *
- * @return the default feature pack location
- */
- protected String getDefaultFeaturePackLocation() {
- return "wildfly@maven(org.jboss.universe:community-universe)";
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/AbstractStartMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/AbstractStartMojo.java
deleted file mode 100644
index d853086c..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/AbstractStartMojo.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.RepositorySystem;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.as.controller.client.helpers.Operations;
-import org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager;
-import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
-import org.wildfly.core.launcher.CommandBuilder;
-import org.wildfly.core.launcher.Launcher;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.StandardOutput;
-import org.wildfly.plugin.core.MavenRepositoriesEnricher;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * @author James R. Perkins
- */
-public abstract class AbstractStartMojo extends AbstractServerConnection {
-
- @Component
- protected RepositorySystem repoSystem;
-
- @Parameter(defaultValue = "${repositorySystemSession}", readonly = true, required = true)
- protected RepositorySystemSession session;
-
- @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true)
- protected List repositories;
-
- @Parameter(defaultValue = "${project}", readonly = true, required = true)
- protected MavenProject project;
-
- @Parameter(defaultValue = "${session}", readonly = true, required = true)
- protected MavenSession mavenSession;
-
- /**
- * The JVM options to use.
- */
- @Parameter(alias = "java-opts", property = PropertyNames.JAVA_OPTS)
- protected String[] javaOpts;
-
- /**
- * The {@code JAVA_HOME} to use for launching the server.
- */
- @Parameter(alias = "java-home", property = PropertyNames.JAVA_HOME)
- protected String javaHome;
-
- /**
- * Starts the server with debugging enabled.
- */
- @Parameter(property = "wildfly.debug", defaultValue = "false")
- protected boolean debug;
-
- /**
- * Sets the hostname to listen on for debugging. An {@code *} means all hosts.
- */
- @Parameter(property = "wildfly.debug.host", defaultValue = "*")
- protected String debugHost;
-
- /**
- * Sets the port the debugger should listen on.
- */
- @Parameter(property = "wildfly.debug.port", defaultValue = "8787")
- protected int debugPort;
-
- /**
- * Indicates whether the server should suspend itself until a debugger is attached.
- */
- @Parameter(property = "wildfly.debug.suspend", defaultValue = "false")
- protected boolean debugSuspend;
-
- /**
- * The path to the system properties file to load.
- */
- @Parameter(alias = "properties-file", property = PropertyNames.PROPERTIES_FILE)
- protected String propertiesFile;
-
- /**
- * The timeout value to use when starting the server.
- */
- @Parameter(alias = "startup-timeout", defaultValue = "60", property = PropertyNames.STARTUP_TIMEOUT)
- private long startupTimeout;
-
- /**
- * The arguments to be passed to the server.
- */
- @Parameter(alias = "server-args", property = PropertyNames.SERVER_ARGS)
- protected String[] serverArgs;
-
- /**
- * Set to {@code true} if you want to skip this goal, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- protected boolean skip;
-
- /**
- * Specifies the environment variables to be passed to the process being started.
- *
- *
- *
- * <env>
- * <HOME>/home/wildfly/</HOME>
- * </env>
- *
- *
- *
- */
- @Parameter
- private Map env;
-
- private final AtomicBoolean initialized = new AtomicBoolean();
-
- protected ServerManager serverManager;
- protected MavenRepoManager mavenRepoManager;
-
- protected void init() throws MojoExecutionException {
- // Setting the mavenRepoManager is not thread-safe, however creating it more than once won't hurt anything
- if (initialized.compareAndSet(false, true)) {
- MavenRepositoriesEnricher.enrich(mavenSession, project, repositories);
- mavenRepoManager = createMavenRepoManager();
- }
- }
-
- protected MavenRepoManager createMavenRepoManager() throws MojoExecutionException {
- return new MavenArtifactRepositoryManager(repoSystem, session, repositories);
- }
-
- protected abstract Path getServerHome() throws MojoExecutionException, MojoFailureException;
-
- protected ServerContext startServer(final ServerType serverType) throws MojoExecutionException, MojoFailureException {
- final Log log = getLog();
- init();
-
- Path server = getServerHome();
-
- // Determine how stdout should be consumed
- try {
- final StandardOutput out = standardOutput();
- // Create the server and close the client after the start. The process will continue running even after
- // the maven process may have been finished
- final ModelControllerClient client = createClient();
- if (ServerManager.isRunning(client)) {
- throw new MojoExecutionException(String.format("%s server is already running?", serverType));
- }
- final CommandBuilder commandBuilder = createCommandBuilder(server);
- log.info(String.format("%s server is starting up.", serverType));
- final Launcher launcher = Launcher.of(commandBuilder)
- .setRedirectErrorStream(true);
- if (env != null) {
- for (Map.Entry entry : env.entrySet()) {
- if (entry.getKey() != null && entry.getValue() != null) {
- launcher.addEnvironmentVariable(entry.getKey(), entry.getValue());
- }
- }
- }
- out.getRedirect().ifPresent(launcher::redirectOutput);
-
- final Process process = launcher.launch();
- if (serverType == ServerType.DOMAIN) {
- serverManager = ServerManager.builder().process(process).client(client).domain();
- } else {
- serverManager = ServerManager.builder().process(process).client(client).standalone();
- }
- // Note that if this thread is started and no shutdown goal is executed this stop the stdout and stderr
- // from being logged any longer. The user was warned in the documentation.
- out.startConsumer(process);
- if (!serverManager.waitFor(startupTimeout, TimeUnit.SECONDS)) {
- throw new MojoExecutionException(String.format("Server failed to start in %s seconds.", startupTimeout));
- }
- if (!process.isAlive()) {
- throw new MojoExecutionException("The process has been terminated before the start goal has completed.");
- }
- return new ServerContext() {
- @Override
- public Process process() {
- return process;
- }
-
- @Override
- public CommandBuilder commandBuilder() {
- return commandBuilder;
- }
-
- @Override
- public Path jbossHome() {
- return server;
- }
- };
- } catch (MojoExecutionException e) {
- throw e;
- } catch (Exception e) {
- throw new MojoExecutionException("The server failed to start", e);
- }
- }
-
- protected abstract CommandBuilder createCommandBuilder(final Path jbossHome) throws MojoExecutionException;
-
- protected StandardOutput standardOutput() throws IOException {
- return StandardOutput.parse(null, false);
- }
-
- /**
- * Allows the {@link #javaOpts} to be set as a string. The string is assumed to be space delimited.
- *
- * @param value a spaced delimited value of JVM options
- */
- @SuppressWarnings("unused")
- public void setJavaOpts(final String value) {
- if (value != null) {
- javaOpts = value.split("\\s+");
- }
- }
-
- /**
- * Checks the current state of the server. If the server is in a state of
- * {@link ClientConstants#CONTROLLER_PROCESS_STATE_RESTART_REQUIRED}, the process is restarted and a new
- * {@link ServerContext} is returned. If the server is in a stat of
- * {@link ClientConstants#CONTROLLER_PROCESS_STATE_RELOAD_REQUIRED}, the server will be reloaded and wait until
- * the server is running. If the server is in any other state, other than
- * {@link ClientConstants#CONTROLLER_PROCESS_STATE_RUNNING}, a warning message is logged to let the user know
- * the state is unknown.
- *
- * @param client the client used to communicate with the server
- * @param context the current server context
- * @return a new context if a restart was required, otherwise the same context
- * @throws IOException if an error occurs communicating with the server
- * @throws MojoExecutionException if a failure occurs checking the state or reloading the server
- * @throws MojoFailureException if a failure occurs checking the state or reloading the server
- */
- protected ServerContext actOnServerState(final ModelControllerClient client, final ServerContext context)
- throws IOException, MojoExecutionException, MojoFailureException {
- final String serverState = serverManager.serverState();
- if (ClientConstants.CONTROLLER_PROCESS_STATE_RESTART_REQUIRED.equals(serverState)) {
- // Shutdown the server
- serverManager.shutdown(timeout);
- // Restart the server process
- return startServer(ServerType.STANDALONE);
- } else if (ClientConstants.CONTROLLER_PROCESS_STATE_RELOAD_REQUIRED.equals(serverState)) {
- serverManager.executeReload(Operations.createOperation("reload"));
- try {
- if (!serverManager.waitFor(startupTimeout, TimeUnit.SECONDS)) {
- throw new MojoExecutionException(String.format("Server failed to start in %s seconds.", startupTimeout));
- }
- } catch (InterruptedException e) {
- throw new MojoExecutionException("Failed to wait for standalone server after a reload.", e);
- }
- } else if (!ClientConstants.CONTROLLER_PROCESS_STATE_RUNNING.equals(serverState)) {
- getLog().warn(String.format(
- "The server may be in an unexpected state for further interaction. The current state is %s", serverState));
- }
- return context;
- }
-
- @Override
- protected int getManagementPort() {
- // Check the java-opts for a management port override
- if (javaOpts != null) {
- for (String opt : javaOpts) {
- if (opt.startsWith("-Djboss.management.http.port=") || opt.startsWith("-Djboss.management.https.port=")) {
- final int equals = opt.indexOf('=');
- return Integer.parseInt(opt.substring(equals + 1).trim());
- }
- if (opt.startsWith("-Djboss.socket.binding.port-offset=")) {
- final int equals = opt.indexOf('=');
- return super.getManagementPort() + Integer.parseInt(opt.substring(equals + 1).trim());
- }
- }
- }
- return super.getManagementPort();
- }
-
- @Override
- protected String getManagementHostName() {
- // Check the java-opts for a management port override
- if (javaOpts != null) {
- for (String opt : javaOpts) {
- if (opt.startsWith("-Djboss.bind.address.management=")) {
- final int equals = opt.indexOf('=');
- return opt.substring(equals + 1).trim();
- }
- }
- }
- return super.getManagementHostName();
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/RunMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/RunMojo.java
deleted file mode 100644
index 04da1067..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/RunMojo.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Inject;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-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.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.core.launcher.CommandBuilder;
-import org.wildfly.plugin.cli.CommandConfiguration;
-import org.wildfly.plugin.cli.CommandExecutor;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.deployment.PackageType;
-import org.wildfly.plugin.tools.Deployment;
-import org.wildfly.plugin.tools.DeploymentManager;
-
-/**
- * Starts a standalone instance of WildFly and deploys the application to the server.
- *
- * This goal will block until cancelled or a shutdown is invoked from a management client.
- *
- *
- * Note that if a WildFly Bootable JAR is packaged, it is ignored by this goal.
- *
- *
- * @author Stuart Douglas
- * @author James R. Perkins
- */
-@Mojo(name = "run", requiresDependencyResolution = ResolutionScope.RUNTIME)
-@Execute(phase = LifecyclePhase.PACKAGE)
-public class RunMojo extends AbstractServerStartMojo {
-
- @Inject
- private CommandExecutor commandExecutor;
-
- /**
- * The CLI commands to execute before the deployment is deployed.
- */
- @Parameter(property = PropertyNames.COMMANDS)
- private List commands = new ArrayList<>();
-
- /**
- * The CLI script files to execute before the deployment is deployed.
- */
- @Parameter(property = PropertyNames.SCRIPTS)
- private List scripts = new ArrayList<>();
-
- /**
- * The path to the server configuration to use.
- */
- @Parameter(alias = "server-config", property = PropertyNames.SERVER_CONFIG)
- private String serverConfig;
-
- /**
- * Specifies the name used for the deployment.
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_NAME)
- private String name;
-
- /**
- * The runtime name for the deployment.
- *
- * In some cases users may wish to have two deployments with the same {@code runtime-name} (e.g. two versions of
- * {@code example.war}) both available in the management configuration, in which case the deployments would need to
- * have distinct {@code name} values but would have the same {@code runtime-name}.
- *
- */
- @Parameter(alias = "runtime-name", property = PropertyNames.DEPLOYMENT_RUNTIME_NAME)
- private String runtimeName;
-
- /**
- * The file name of the application to be deployed.
- *
- * The {@code filename} property does have a default of ${project.build.finalName}.${project.packaging}
.
- * The default value is not injected as it normally would be due to packaging types like {@code ejb} that result in
- * a file with a {@code .jar} extension rather than an {@code .ejb} extension.
- *
- */
- @Parameter(property = PropertyNames.DEPLOYMENT_FILENAME)
- private String filename;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- return;
- }
- try {
- final Log log = getLog();
- final Path deploymentContent = getDeploymentContent();
- // The deployment must exist before we do anything
- if (Files.notExists(deploymentContent)) {
- throw new MojoExecutionException(
- String.format("The deployment '%s' could not be found.", deploymentContent.toAbsolutePath()));
- }
- // Start the server
- log.info("Server is starting up. Press CTRL + C to stop the server.");
- final ServerContext context = startServer(ServerType.STANDALONE);
- Process process = context.process();
- try (ModelControllerClient client = createClient()) {
- // Execute commands before the deployment is done
- final CommandConfiguration cmdConfig = CommandConfiguration.of(this::createClient, this::getClientConfiguration)
- .addCommands(commands)
- .addScripts(scripts)
- .setJBossHome(context.jbossHome())
- .setAutoReload(false)
- .setFork(true)
- .setStdout("none")
- .setTimeout(timeout)
- .build();
- commandExecutor.execute(cmdConfig, mavenRepoManager);
-
- process = actOnServerState(client, context).process();
- // Create the deployment and deploy
- final Deployment deployment = Deployment.of(deploymentContent)
- .setName(name)
- .setRuntimeName(runtimeName);
- final DeploymentManager deploymentManager = DeploymentManager.Factory.create(client);
- deploymentManager.forceDeploy(deployment);
- } catch (MojoExecutionException | MojoFailureException e) {
- if (process != null) {
- process.destroyForcibly().waitFor(10L, TimeUnit.SECONDS);
- }
- throw e;
- }
- try {
- // Wait for the process to die
- boolean keepRunning = true;
- while (keepRunning) {
- final int exitCode = process.waitFor();
- // 10 is the magic code used in the scripts to survive a :shutdown(restart=true) operation
- if (exitCode == 10) {
- // Ensure the current process is destroyed and restart a new one
- process.destroy();
- process = startServer(ServerType.STANDALONE).process();
- } else {
- keepRunning = false;
- }
- }
- } catch (Exception e) {
- throw new MojoExecutionException("The server failed to start", e);
- } finally {
- if (process != null)
- process.destroy();
- }
- } catch (Exception e) {
- throw new MojoExecutionException("The server failed to start", e);
- }
- }
-
- @Override
- protected CommandBuilder createCommandBuilder(final Path jbossHome) throws MojoExecutionException {
- return createStandaloneCommandBuilder(jbossHome, serverConfig);
- }
-
- @Override
- public String goal() {
- return "run";
- }
-
- private Path getDeploymentContent() {
- final PackageType packageType = PackageType.resolve(project);
- final String filename;
- if (this.filename == null) {
- filename = String.format("%s.%s", project.getBuild().getFinalName(), packageType.getFileExtension());
- } else {
- filename = this.filename;
- }
- return targetDir.toPath().resolve(filename);
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/ShutdownMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/ShutdownMojo.java
deleted file mode 100644
index 8ddf0740..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/ShutdownMojo.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.wildfly.plugin.common.AbstractServerConnection;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * Shuts down a running WildFly Application Server.
- *
- * Can also be used to issue a reload instead of a full shutdown. If a reload is executed the process will wait for the
- * serer to be available before returning.
- *
- * @author James R. Perkins
- */
-@Mojo(name = "shutdown")
-public class ShutdownMojo extends AbstractServerConnection {
-
- /**
- * Set to {@code true} if a {@code reload} operation should be invoked instead of a {@code shutdown}. For domain
- * servers this executes a {@code reload-servers} operation. If set to {@code true} the process will wait up to the
- * {@code timeout} limit for the server to be available before returning.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.RELOAD)
- private boolean reload;
-
- /**
- * Set to {@code true} if you want to skip server shutdown, otherwise {@code false}.
- */
- @Parameter(defaultValue = "false", property = PropertyNames.SKIP)
- private boolean skip;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- if (skip) {
- getLog().debug("Skipping server shutdown");
- return;
- }
- try (ModelControllerClient client = createClient()) {
- if (ServerManager.isRunning(client)) {
- final ServerManager serverManager = ServerManager.builder().client(client).build().get(timeout,
- TimeUnit.SECONDS);
- if (reload) {
- if (serverManager.containerDescription().isDomain()) {
- client.execute(ServerOperations.createOperation("reload-servers"));
- } else {
- client.execute(ServerOperations.createOperation(ServerOperations.RELOAD));
- }
- serverManager.waitFor(timeout, TimeUnit.SECONDS);
- } else {
- serverManager.shutdown();
- }
- // Bad hack to get maven to complete it's message output
- try {
- TimeUnit.MILLISECONDS.sleep(500L);
- } catch (InterruptedException ignore) {
- ignore.printStackTrace();
- // no-op
- }
- }
- } catch (IOException e) {
- throw new MojoExecutionException(String.format("Please make sure a server is running before executing goal " +
- "%s. Reason: %s", goal(), e.getMessage()), e);
- } catch (Exception e) {
- throw new MojoExecutionException(String.format("Could not execute goal %s. Reason: %s", goal(), e.getMessage()), e);
- }
- }
-
- @Override
- public String goal() {
- return "shutdown";
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/StartJarMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/StartJarMojo.java
deleted file mode 100644
index cfb9aac2..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/StartJarMojo.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.wildfly.core.launcher.BootableJarCommandBuilder;
-import org.wildfly.core.launcher.CommandBuilder;
-import org.wildfly.plugin.common.Environment;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.StandardOutput;
-import org.wildfly.plugin.common.Utils;
-
-/**
- * Starts a WildFly Application Server packaged as Bootable JAR.
- *
- * The purpose of this goal is to start a WildFly Application Server packaged as a Bootable JAR for testing during the maven
- * lifecycle.
- *
- * @since 5.0
- */
-@Mojo(name = "start-jar", requiresDependencyResolution = ResolutionScope.RUNTIME)
-public class StartJarMojo extends AbstractStartMojo {
-
- /**
- * Indicates how {@code stdout} and {@code stderr} should be handled for the spawned server process. Note that
- * {@code stderr} will be redirected to {@code stdout} if the value is defined unless the value is {@code none}.
- *
- * By default {@code stdout} and {@code stderr} are inherited from the current process. You can change the setting
- * to one of the follow:
- *
- * - {@code none} indicates the {@code stdout} and {@code stderr} stream should not be consumed. This should
- * generally only be used if the {@code shutdown} goal is used in the same maven process.
- * - {@code System.out} or {@code System.err} to redirect to the current processes (use this option if you
- * see odd behavior from maven with the default value)
- * - Any other value is assumed to be the path to a file and the {@code stdout} and {@code stderr} will be
- * written there
- *
- *
- *
- * Note that if this goal is not later followed by a {@code shutdown} goal in the same maven process you should use
- * a file to redirect the {@code stdout} and {@code stderr} to. Both output streams will be redirected to the same
- * file.
- *
- */
- @Parameter(property = PropertyNames.STDOUT)
- private String stdout;
-
- /**
- * When {@code bootable-jar} is set to true, use this parameter to name the generated jar file.
- *
- * Note that since 5.1 the default name changed from {@code server-bootable.jar} to
- * {@code ${project.artifactId}-bootable.jar}.
- *
- */
- @Parameter(alias = "bootable-jar-name", property = PropertyNames.BOOTABLE_JAR_NAME, defaultValue = "${project.artifactId}-bootable.jar")
- private String bootableJarName;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- final Log log = getLog();
- if (skip) {
- log.debug("Skipping server start");
- return;
- }
-
- // Determine how stdout should be consumed
- try {
- startServer(ServerType.STANDALONE);
- } catch (MojoExecutionException e) {
- throw e;
- } catch (Exception e) {
- throw new MojoExecutionException("The server failed to start", e);
- }
- }
-
- @Override
- protected CommandBuilder createCommandBuilder(final Path server) throws MojoExecutionException {
- BootableJarCommandBuilder commandBuilder = BootableJarCommandBuilder.of(server).setJavaHome(javaHome);
-
- // Set the JVM options
- if (Utils.isNotNullOrEmpty(javaOpts)) {
- commandBuilder.setJavaOptions(javaOpts);
- }
- if (debug) {
- commandBuilder.addJavaOptions(String.format("-agentlib:jdwp=transport=dt_socket,server=y,suspend=%s,address=%s:%d",
- debugSuspend ? "y" : "n", debugHost, debugPort));
- }
-
- if (propertiesFile != null) {
- commandBuilder.addServerArgument("-P" + propertiesFile);
- }
-
- if (serverArgs != null) {
- commandBuilder.addServerArguments(serverArgs);
- }
-
- final Path javaHomePath = (this.javaHome == null ? Paths.get(System.getProperty("java.home"))
- : Paths.get(this.javaHome));
- if (Environment.isModularJvm(javaHomePath)) {
- commandBuilder.addJavaOptions(Environment.getModularJvmArguments());
- }
-
- // Print some server information
- final Log log = getLog();
- log.info("JAVA_HOME : " + commandBuilder.getJavaHome());
- log.info("JAVA_OPTS : " + Utils.toString(commandBuilder.getJavaOptions(), " "));
- return commandBuilder;
- }
-
- @Override
- protected StandardOutput standardOutput() throws IOException {
- return StandardOutput.parse(stdout, true);
- }
-
- @Override
- public String goal() {
- return "start-jar";
- }
-
- @Override
- protected Path getServerHome() throws MojoExecutionException, MojoFailureException {
- String jarName = bootableJarName;
- Path targetPath = Paths.get(project.getBuild().getDirectory());
- Path jarFile = targetPath.toAbsolutePath()
- .resolve(jarName);
- if (!Files.exists(jarFile)) {
- throw new MojoExecutionException(String.format("Bootable JAR file '%s' doesn't exist.", jarFile));
- }
- return jarFile;
- }
-}
diff --git a/plugin/src/main/java/org/wildfly/plugin/server/StartMojo.java b/plugin/src/main/java/org/wildfly/plugin/server/StartMojo.java
deleted file mode 100644
index 3a5de43d..00000000
--- a/plugin/src/main/java/org/wildfly/plugin/server/StartMojo.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.IOException;
-import java.nio.file.Path;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.wildfly.core.launcher.CommandBuilder;
-import org.wildfly.plugin.common.PropertyNames;
-import org.wildfly.plugin.common.StandardOutput;
-
-/**
- * Starts a standalone instance of WildFly Application Server.
- *
- * The purpose of this goal is to start a WildFly Application Server for testing during the maven lifecycle.
- *
- *
- * Note that if a WildFly Bootable JAR is packaged, it is ignored by this goal.
- *
- *
- * @author James R. Perkins
- */
-@Mojo(name = "start", requiresDependencyResolution = ResolutionScope.RUNTIME)
-public class StartMojo extends AbstractServerStartMojo {
-
- /**
- * The path to the server configuration to use. This is only used for standalone servers.
- */
- @Parameter(alias = "server-config", property = PropertyNames.SERVER_CONFIG)
- private String serverConfig;
-
- /**
- * The name of the domain configuration to use. This is only used for domain servers.
- */
- @Parameter(alias = "domain-config", property = PropertyNames.DOMAIN_CONFIG)
- private String domainConfig;
-
- /**
- * The name of the host configuration to use. This is only used for domain servers.
- */
- @Parameter(alias = "host-config", property = PropertyNames.HOST_CONFIG)
- private String hostConfig;
-
- /**
- * The type of server to start.
- *
- * {@code STANDALONE} for a standalone server and {@code DOMAIN} for a domain server.
- *
- */
- @Parameter(alias = "server-type", property = "wildfly.server.type", defaultValue = "STANDALONE")
- protected ServerType serverType;
-
- /**
- * Indicates how {@code stdout} and {@code stderr} should be handled for the spawned server process. Note that
- * {@code stderr} will be redirected to {@code stdout} if the value is defined unless the value is {@code none}.
- *
- * By default {@code stdout} and {@code stderr} are inherited from the current process. You can change the setting
- * to one of the follow:
- *
- * - {@code none} indicates the {@code stdout} and {@code stderr} stream should not be consumed. This should
- * generally only be used if the {@code shutdown} goal is used in the same maven process.
- * - {@code System.out} or {@code System.err} to redirect to the current processes (use this option if you
- * see odd behavior from maven with the default value)
- * - Any other value is assumed to be the path to a file and the {@code stdout} and {@code stderr} will be
- * written there
- *
- *
- *
- * Note that if this goal is not later followed by a {@code shutdown} goal in the same maven process you should use
- * a file to redirect the {@code stdout} and {@code stderr} to. Both output streams will be redirected to the same
- * file.
- *
- */
- @Parameter(property = PropertyNames.STDOUT)
- private String stdout;
-
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- final Log log = getLog();
- if (skip) {
- log.debug("Skipping server start");
- return;
- }
-
- // Determine how stdout should be consumed
- try {
- startServer(serverType);
- } catch (MojoExecutionException e) {
- throw e;
- } catch (Exception e) {
- throw new MojoExecutionException("The server failed to start", e);
- }
- }
-
- @Override
- protected CommandBuilder createCommandBuilder(final Path jbossHome) throws MojoExecutionException {
- if (serverType == ServerType.DOMAIN) {
- return createDomainCommandBuilder(jbossHome, domainConfig, hostConfig);
- }
- return createStandaloneCommandBuilder(jbossHome, serverConfig);
- }
-
- @Override
- protected StandardOutput standardOutput() throws IOException {
- return StandardOutput.parse(stdout, true);
- }
-
- @Override
- public String goal() {
- return "start";
- }
-}
diff --git a/pom.xml b/pom.xml
index 22b10858..f7c13aac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,9 +12,9 @@
wildfly-parent
1.0.4.Final
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-parent
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
pom
WildFly Maven Plugin - Parent
@@ -96,7 +96,6 @@
3.5.3
0.3.5
- 2.3.1
2.3.3
@@ -114,7 +113,6 @@
6.0.4.Final
- 1.1.1.Final
true
1.2.1.Final
@@ -124,7 +122,7 @@
WildFly
- wildfly
+ eap
6.2
${version.org.wildfly}
@@ -430,11 +428,6 @@
-
- org.wildfly.glow
- wildfly-glow-core
- ${version.org.wildfly.glow}
-
jakarta.json
diff --git a/tests/bootable-tests/pom.xml b/tests/bootable-tests/pom.xml
index b8fcf341..949f499e 100644
--- a/tests/bootable-tests/pom.xml
+++ b/tests/bootable-tests/pom.xml
@@ -8,9 +8,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-tests
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
wildfly-maven-plugin-bootable-tests
@@ -83,7 +83,7 @@
${project.groupId}
- wildfly-maven-plugin
+ eap-maven-plugin
${project.version}
diff --git a/tests/bootable-tests/src/test/java/org/wildfly/plugin/bootable/PackageBootableTest.java b/tests/bootable-tests/src/test/java/org/wildfly/plugin/bootable/PackageBootableTest.java
index 64c6d6ce..deda1035 100644
--- a/tests/bootable-tests/src/test/java/org/wildfly/plugin/bootable/PackageBootableTest.java
+++ b/tests/bootable-tests/src/test/java/org/wildfly/plugin/bootable/PackageBootableTest.java
@@ -6,9 +6,11 @@
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Ignore;
import org.junit.Test;
import org.wildfly.plugin.tests.AbstractProvisionConfiguredMojoTestCase;
import org.wildfly.plugin.tests.AbstractWildFlyMojoTest;
@@ -18,7 +20,7 @@ public class PackageBootableTest extends AbstractProvisionConfiguredMojoTestCase
private static final String BOOTABLE_JAR_NAME = "server-bootable.jar";
public PackageBootableTest() {
- super("wildfly-maven-plugin");
+ super("eap-maven-plugin");
}
@Test
@@ -42,7 +44,7 @@ public void testBootableRootPackage() throws Exception {
String deploymentName = "ROOT.war";
Path rootWar = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve(deploymentName);
Path testWar = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("test.war");
- Files.copy(testWar, rootWar);
+ Files.copy(testWar, rootWar, StandardCopyOption.REPLACE_EXISTING);
Files.delete(testWar);
packageMojo.execute();
String[] layers = { "jaxrs-server" };
@@ -52,6 +54,7 @@ public void testBootableRootPackage() throws Exception {
}
@Test
+ @Ignore
public void testGlowPackage() throws Exception {
final Mojo packageMojo = lookupConfiguredMojo(
@@ -64,6 +67,7 @@ public void testGlowPackage() throws Exception {
}
@Test
+ @Ignore
public void testGlowCloudPackage() throws Exception {
final Mojo packageMojo = lookupConfiguredMojo(
diff --git a/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-cloud-pom.xml b/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-cloud-pom.xml
index 9cc9b7f2..b7692cc1 100644
--- a/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-cloud-pom.xml
+++ b/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-cloud-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
true
diff --git a/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-pom.xml b/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-pom.xml
index a0f05890..cad7eb00 100644
--- a/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-pom.xml
+++ b/tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
true
diff --git a/tests/bootable-tests/src/test/resources/test-project/package-bootable-pom.xml b/tests/bootable-tests/src/test/resources/test-project/package-bootable-pom.xml
index 9b1072ad..cb749042 100644
--- a/tests/bootable-tests/src/test/resources/test-project/package-bootable-pom.xml
+++ b/tests/bootable-tests/src/test/resources/test-project/package-bootable-pom.xml
@@ -27,8 +27,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
@@ -43,6 +43,7 @@
true
packaged-bootable-server
true
+ true
diff --git a/tests/bootable-tests/src/test/resources/test-project/package-bootable-root-pom.xml b/tests/bootable-tests/src/test/resources/test-project/package-bootable-root-pom.xml
index 17f5e1c2..b3439655 100644
--- a/tests/bootable-tests/src/test/resources/test-project/package-bootable-root-pom.xml
+++ b/tests/bootable-tests/src/test/resources/test-project/package-bootable-root-pom.xml
@@ -27,8 +27,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/domain-tests/pom.xml b/tests/domain-tests/pom.xml
index 16a99117..ba5c0ac0 100644
--- a/tests/domain-tests/pom.xml
+++ b/tests/domain-tests/pom.xml
@@ -8,9 +8,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-tests
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
wildfly-maven-plugin-domain-tests
diff --git a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java b/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java
deleted file mode 100644
index 9ee41252..00000000
--- a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.apache.maven.plugin.Mojo;
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.as.controller.client.helpers.Operations.CompositeOperationBuilder;
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.UndeployDescription;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * deploy mojo testcase.
- *
- * @author Heinz Wilming
- */
-public class DeployTest extends AbstractWildFlyServerMojoTest {
- private static final String DEFAULT_SERVER_GROUP = "main-server-group";
- private static final Set DEFAULT_SERVER_GROUPS = Collections.singleton(DEFAULT_SERVER_GROUP);
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @Test
- public void testDeploy() throws Exception {
-
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
- executeAndVerifyDeploymentExists("deploy", "deploy-webarchive-pom.xml");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
-
- @Test
- public void testDeployWithRuntimeName() throws Exception {
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
- executeAndVerifyDeploymentExists("deploy", "deploy-webarchive-with-runtime-name-pom.xml", "test-runtime.war");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
-
- @Test
- public void testDeployOnly() throws Exception {
-
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
- executeAndVerifyDeploymentExists("deploy-only", "deploy-webarchive-pom.xml");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
-
- @Test
- public void testDeployWithStoppedServer() throws Exception {
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
- final ModelNode address = ServerManager.builder().client(client).domain().determineHostAddress().add("server-config")
- .add("server-one");
- try {
- // Shutdown server-one
- final ModelNode op = ServerOperations.createOperation("stop", address);
- op.get("blocking").set(true);
- executeOperation(op);
-
- executeAndVerifyDeploymentExists("deploy", "deploy-webarchive-pom.xml");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- } finally {
- // Restart server-twp
- final ModelNode op = ServerOperations.createOperation("start", address);
- op.get("blocking").set(true);
- executeOperation(op);
- }
- }
-
- @Test
- public void testDeployNewServerGroup() throws Exception {
- // Make sure the deployment is deployed to the main-server-group and not deployed to the other-server-group
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME, "main-server-group")) {
- deploymentManager.deploy(getDeployment().addServerGroup("main-server-group"));
- }
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME, "other-server-group")) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroup("other-deployment-group"));
- }
- // Set up the other-server-group servers to ensure the full deployment process works correctly
- final ModelNode op = ServerOperations.createOperation("start-servers",
- ServerOperations.createAddress(ClientConstants.SERVER_GROUP, "other-server-group"));
- op.get("blocking").set(true);
- executeOperation(op);
-
- // Deploy to both server groups and ensure the deployment exists on both, it should already be on the
- // main-server-group and should have been added to the other-server-group
- final Set serverGroups = new HashSet<>(Arrays.asList("main-server-group", "other-server-group"));
- executeAndVerifyDeploymentExists("deploy", "deploy-multi-server-group-pom.xml", null, serverGroups);
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(serverGroups));
- }
-
- @Test
- public void testRedeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.deploy(getDeployment().addServerGroup(DEFAULT_SERVER_GROUP));
- }
-
- executeAndVerifyDeploymentExists("redeploy", "deploy-webarchive-pom.xml");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
-
- @Test
- public void testRedeployOnly() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.deploy(getDeployment().addServerGroup(DEFAULT_SERVER_GROUP));
- }
-
- executeAndVerifyDeploymentExists("redeploy-only", "deploy-webarchive-pom.xml");
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME).addServerGroups(DEFAULT_SERVER_GROUPS));
- }
-
- @Test
- public void testUndeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP)) {
- deploymentManager.deploy(getDeployment().addServerGroup(DEFAULT_SERVER_GROUP));
- }
-
- final UndeployMojo deployMojo = lookupMojoAndVerify("undeploy", "undeploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertFalse("Deployment " + DEPLOYMENT_NAME + " was not undeployed",
- deploymentManager.hasDeployment(DEPLOYMENT_NAME, DEFAULT_SERVER_GROUP));
- }
-
- @Override
- public T lookupMojoAndVerify(final String goal, final String fileName) throws Exception {
- final Mojo mojo = super.lookupMojoAndVerify(goal, fileName);
- setValue(mojo, "serverGroups", Collections.singletonList("main-server-group"));
- return (T) mojo;
- }
-
- private void executeAndVerifyDeploymentExists(final String goal, final String fileName) throws Exception {
- executeAndVerifyDeploymentExists(goal, fileName, null);
- }
-
- private void executeAndVerifyDeploymentExists(final String goal, final String fileName, final String runtimeName)
- throws Exception {
- executeAndVerifyDeploymentExists(goal, fileName, runtimeName, Collections.singleton("main-server-group"));
- }
-
- private void executeAndVerifyDeploymentExists(final String goal, final String fileName, final String runtimeName,
- final Collection serverGroups) throws Exception {
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify(goal, fileName);
-
- // Server groups are required to be set and when there is a property defined on an attribute parameter the
- // test harness does not set the fields
- setValue(deployMojo, "serverGroups", new ArrayList<>(serverGroups));
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // Verify deployed on all server groups
- for (String serverGroup : serverGroups) {
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed on server group " + serverGroup,
- deploymentManager.hasDeployment(DEPLOYMENT_NAME, serverGroup));
- }
-
- // /deployment=test.war :read-attribute(name=status)
- final CompositeOperationBuilder builder = CompositeOperationBuilder.create();
- for (String serverGroup : serverGroups) {
- final ModelNode address = ServerOperations.createAddress(ClientConstants.SERVER_GROUP, serverGroup,
- ClientConstants.DEPLOYMENT, DEPLOYMENT_NAME);
- builder.addStep(ServerOperations.createReadAttributeOperation(address, "runtime-name"));
- }
- if (runtimeName != null) {
- final ModelNode result = client.execute(builder.build());
- assertTrue(ServerOperations.getFailureDescriptionAsString(result), ServerOperations.isSuccessfulOutcome(result));
- // Get the result of the step
- final ModelNode stepResults = ServerOperations.readResult(result);
- final Set stepKeys = stepResults.keys();
- for (String stepKey : stepKeys) {
- assertEquals("Runtime name does not match", runtimeName,
- ServerOperations.readResultAsString(stepResults.get(stepKey)));
- }
- }
- }
-
-}
diff --git a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java b/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java
deleted file mode 100644
index d9d5e275..00000000
--- a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.as.controller.client.helpers.Operations;
-import org.jboss.dmr.ModelNode;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.DeploymentDescription;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.DeploymentResult;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * Matcher Undeployment test case.
- *
- * @author Mark Paluch
- */
-public class UndeploymentMatchTest extends AbstractWildFlyServerMojoTest {
- private static final String DEPLOYMENT_NAME_1 = "test-undeploy-1.war";
- private static final String DEPLOYMENT_NAME_2 = "test-undeploy-2.war";
-
- private final Set defaultServerGroups = Collections.singleton("main-server-group");
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @Before
- public void setup() throws Exception {
- deploymentManager.deploy(getDeployment().setName(DEPLOYMENT_NAME_1).addServerGroups(defaultServerGroups));
- deploymentManager.deploy(getDeployment().setName(DEPLOYMENT_NAME_2).addServerGroups(defaultServerGroups));
- }
-
- @After
- public void cleanup() throws Exception {
- final Set deployments = new HashSet<>();
- for (DeploymentDescription deployment : deploymentManager.getDeployments()) {
- deployments.add(UndeployDescription.of(deployment));
- }
- if (!deployments.isEmpty()) {
- deploymentManager.undeploy(deployments).assertSuccess();
- }
- }
-
- @Test
- public void undeployAll() throws Exception {
- undeploy(MatchPatternStrategy.ALL);
-
- final Set deployments = deploymentManager.getDeployments();
- assertEquals(0, deployments.size());
- }
-
- @Test
- public void undeployFirst() throws Exception {
-
- undeploy(MatchPatternStrategy.FIRST);
-
- final Set deployments = deploymentManager.getDeployments();
- assertEquals(1, deployments.size());
- }
-
- @Test
- public void undeployFirstMultiServerGroup() throws Exception {
- final String serverGroup = "other-server-group";
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME_1, serverGroup)) {
- final DeploymentResult result = deploymentManager
- .forceDeploy(getDeployment().setName(DEPLOYMENT_NAME_1).addServerGroup(serverGroup));
- Assert.assertTrue(result.getFailureMessage(), result.successful());
- }
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME_2, serverGroup)) {
- final DeploymentResult result = deploymentManager
- .forceDeploy(getDeployment().setName(DEPLOYMENT_NAME_2).addServerGroup(serverGroup));
- Assert.assertTrue(result.getFailureMessage(), result.successful());
- }
- // Set up the other-server-group servers to ensure the full deployment process works correctly
- final ModelNode op = Operations.createOperation("start-servers",
- new ModelNode().setEmptyList().add(ClientConstants.SERVER_GROUP, "other-server-group"));
- op.get("blocking").set(true);
- executeOperation(op);
-
- undeploy(MatchPatternStrategy.FIRST, "undeploy-multi-server-group-match-pom.xml",
- Arrays.asList("main-server-group", "other-server-group"));
-
- final Set deployments = deploymentManager.getDeployments();
- assertEquals(1, deployments.size());
-
- assertTrue("Deployment " + DEPLOYMENT_NAME_2 + " was not found on main-server-group",
- deploymentManager.hasDeployment(DEPLOYMENT_NAME_2, "main-server-group"));
- assertTrue("Deployment " + DEPLOYMENT_NAME_2 + " was not found on other-server-group",
- deploymentManager.hasDeployment(DEPLOYMENT_NAME_2, "other-server-group"));
- }
-
- @Test(expected = MojoDeploymentException.class)
- public void undeployFail() throws Exception {
- undeploy(MatchPatternStrategy.FAIL);
- }
-
- @Test
- public void testUndeployServerGroup() throws Exception {
- final String deploymentName1 = "test.war";
- final String deploymentName2 = "test-qa.war";
- if (!deploymentManager.hasDeployment(deploymentName1, "main-server-group")) {
- deploymentManager.deploy(getDeployment().setName(deploymentName1).addServerGroup("main-server-group"));
- }
- // This deployment should stay deployed since it's only on the other-server-group
- if (!deploymentManager.hasDeployment(deploymentName2, "other-server-group")) {
- deploymentManager.deploy(getDeployment().setName(deploymentName2).addServerGroup("other-server-group"));
- }
- undeploy(MatchPatternStrategy.ALL);
-
- assertEquals(0, deploymentManager.getDeployments("main-server-group").size());
- assertEquals(1, deploymentManager.getDeployments("other-server-group").size());
- }
-
- private void undeploy(final MatchPatternStrategy matchPatternStrategy) throws Exception {
- undeploy(matchPatternStrategy, "undeploy-webarchive-match-pom.xml");
- }
-
- private void undeploy(final MatchPatternStrategy matchPatternStrategy, final String pomName) throws Exception {
- undeploy(matchPatternStrategy, pomName, Collections.singletonList("main-server-group"));
- }
-
- private void undeploy(final MatchPatternStrategy matchPatternStrategy, final String pomName,
- final List serverGroups) throws Exception {
-
- final UndeployMojo undeployMojo = lookupMojoAndVerify("undeploy", pomName);
- // Server groups are required to be set and when there is a property defined on an attribute parameter the
- // test harness does not set the fields
- setValue(undeployMojo, "serverGroups", serverGroups);
-
- setValue(undeployMojo, "matchPatternStrategy", matchPatternStrategy.toString());
- undeployMojo.execute();
- }
-
-}
diff --git a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java b/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java
deleted file mode 100644
index 5793bfe1..00000000
--- a/tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment.resources;
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-
-import org.junit.Test;
-import org.wildfly.plugin.deployment.resource.AddResourceMojo;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-
-/**
- * AddResource test case
- *
- * @author Dave Heath
- */
-// @Ignore("Composite operations don't seem to be working with datasources")
-public class AddResourceTest extends AbstractWildFlyServerMojoTest {
-
- @Test
- public void testCanAddCompositeResource() throws Exception {
-
- final AddResourceMojo addResourceMojo = find("add-resource-with-composite-pom.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
- @Test
- public void testCanAddResource() throws Exception {
-
- AddResourceMojo addResourceMojo = find("add-resource-pom.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
- @Test
- public void testCanAddXaDataSource() throws Exception {
-
- final AddResourceMojo addResourceMojo = find("add-resource-xa-datasource.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
- private AddResourceMojo find(final String pom) throws Exception {
- final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", pom);
- // Profiles are required to be set and when there is a property defined on an attribute parameter the test
- // harness does not set the fields
- setValue(addResourceMojo, "profiles", Collections.singletonList("full"));
- return addResourceMojo;
- }
-
-}
diff --git a/tests/domain-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java b/tests/domain-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
index 83edf691..f07c26ac 100644
--- a/tests/domain-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
+++ b/tests/domain-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
@@ -14,7 +14,7 @@
public class ProvisionTest extends AbstractProvisionConfiguredMojoTestCase {
public ProvisionTest() {
- super("wildfly-maven-plugin");
+ super("eap-maven-plugin");
}
@Test
diff --git a/tests/domain-tests/src/test/java/org/wildfly/plugin/server/DomainTestServer.java b/tests/domain-tests/src/test/java/org/wildfly/plugin/server/DomainTestServer.java
index 93e58852..5625860a 100644
--- a/tests/domain-tests/src/test/java/org/wildfly/plugin/server/DomainTestServer.java
+++ b/tests/domain-tests/src/test/java/org/wildfly/plugin/server/DomainTestServer.java
@@ -12,6 +12,7 @@
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.domain.DomainClient;
import org.junit.Assert;
+import org.junit.Ignore;
import org.wildfly.core.launcher.DomainCommandBuilder;
import org.wildfly.core.launcher.Launcher;
import org.wildfly.core.launcher.ProcessHelper;
@@ -24,6 +25,7 @@
/**
* @author James R. Perkins
*/
+@Ignore
@SuppressWarnings("Duplicates")
public class DomainTestServer implements TestServer {
diff --git a/tests/domain-tests/src/test/resources/test-project/add-resource-pom.xml b/tests/domain-tests/src/test/resources/test-project/add-resource-pom.xml
index ca9ff613..2b90ee87 100644
--- a/tests/domain-tests/src/test/resources/test-project/add-resource-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/add-resource-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
full
diff --git a/tests/domain-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml b/tests/domain-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
index 73028d13..c1d9f845 100644
--- a/tests/domain-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
full
diff --git a/tests/domain-tests/src/test/resources/test-project/add-resource-xa-datasource.xml b/tests/domain-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
index cbebd52f..0caf7f5f 100644
--- a/tests/domain-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
+++ b/tests/domain-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
full
diff --git a/tests/domain-tests/src/test/resources/test-project/deploy-multi-server-group-pom.xml b/tests/domain-tests/src/test/resources/test-project/deploy-multi-server-group-pom.xml
index c06a2962..56c3ded0 100644
--- a/tests/domain-tests/src/test/resources/test-project/deploy-multi-server-group-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/deploy-multi-server-group-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
diff --git a/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-pom.xml b/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
index ffb4a771..3113118e 100644
--- a/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
diff --git a/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml b/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
index bc944ed8..2d520d1f 100644
--- a/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test-runtime.war
test.war
diff --git a/tests/domain-tests/src/test/resources/test-project/provision-pom.xml b/tests/domain-tests/src/test/resources/test-project/provision-pom.xml
index baffa910..ed49f02e 100644
--- a/tests/domain-tests/src/test/resources/test-project/provision-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/provision-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/domain-tests/src/test/resources/test-project/undeploy-multi-server-group-match-pom.xml b/tests/domain-tests/src/test/resources/test-project/undeploy-multi-server-group-match-pom.xml
index 4e27a12f..6716d5cc 100644
--- a/tests/domain-tests/src/test/resources/test-project/undeploy-multi-server-group-match-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/undeploy-multi-server-group-match-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
test.*.war
diff --git a/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml b/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
index 90abebb9..79bdb896 100644
--- a/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
test.*.war
diff --git a/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml b/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
index 8b7408aa..be1376ee 100644
--- a/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
+++ b/tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
diff --git a/tests/pom.xml b/tests/pom.xml
index bcc0d43c..f08d8e46 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -8,9 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-parent
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
4.0.0
@@ -34,14 +34,14 @@
${project.groupId}
- wildfly-maven-plugin
+ eap-maven-plugin
${project.version}
provision-wildfly
generate-test-resources
- provision
+ package
diff --git a/tests/shared/pom.xml b/tests/shared/pom.xml
index 513e79ac..3f2d4d2d 100644
--- a/tests/shared/pom.xml
+++ b/tests/shared/pom.xml
@@ -8,9 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-tests
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
4.0.0
@@ -29,7 +29,7 @@
${project.groupId}
- wildfly-maven-plugin
+ eap-maven-plugin
${project.version}
@@ -57,7 +57,16 @@
org.mockito
mockito-core
-
+
+ org.wildfly.core
+ wildfly-controller-client
+
+
+ org.jboss.modules
+ jboss-modules
+
+
+
diff --git a/tests/shared/src/test/java/org/wildfly/plugin/server/ServerFunctionMojoTest.java b/tests/shared/src/test/java/org/wildfly/plugin/server/ServerFunctionMojoTest.java
deleted file mode 100644
index c7c0fda4..00000000
--- a/tests/shared/src/test/java/org/wildfly/plugin/server/ServerFunctionMojoTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.server;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.domain.DomainClient;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Test;
-import org.wildfly.plugin.tests.AbstractWildFlyMojoTest;
-import org.wildfly.plugin.tests.TestEnvironment;
-import org.wildfly.plugin.tools.server.ServerManager;
-
-/**
- * @author James R. Perkins
- */
-public class ServerFunctionMojoTest extends AbstractWildFlyMojoTest {
-
- @After
- public void shutdown() throws Exception {
- // Ensure the server is shutdown
- try (ModelControllerClient client = createClient()) {
- ServerManager serverManager = ServerManager.builder()
- .client(client)
- .standalone();
- if (serverManager.isRunning()) {
- serverManager.shutdown();
- }
- serverManager = ServerManager.builder()
- .client(client)
- .domain();
- if (serverManager.isRunning()) {
- serverManager.shutdown();
- }
- }
- }
-
- @Test
- public void testStartStandalone() throws Exception {
- final StartMojo mojo = getStartMojo();
- mojo.execute();
- try (ModelControllerClient client = createClient()) {
- final ServerManager serverManager = ServerManager.builder().client(client).standalone();
- // Verify the server is running
- Assert.assertTrue("The start goal did not start the server.", serverManager.isRunning());
- Assert.assertFalse("This should be a standalone server, but found a domain server.",
- serverManager.containerDescription().isDomain());
- }
- }
-
- @Test
- public void testShutdownStandalone() throws Exception {
- // Start up the server and ensure it's running
- final StartMojo startMojo = getStartMojo();
- startMojo.execute();
- try (ModelControllerClient client = createClient()) {
- final ServerManager serverManager = ServerManager.builder().client(client).standalone();
- // Verify the server is running
- Assert.assertTrue("The start goal did not start the server.", serverManager.isRunning());
- }
-
- // Look up the stop mojo and attempt to stop
- final ShutdownMojo stopMojo = lookupMojoAndVerify("shutdown", "shutdown-pom.xml");
- stopMojo.execute();
- try (ModelControllerClient client = createClient()) {
- final ServerManager serverManager = ServerManager.builder().client(client).standalone();
- // Verify the server is running
- Assert.assertFalse("The start goal did not start the server.", serverManager.isRunning());
- }
- }
-
- @Test
- public void testStartAndAddUserStandalone() throws Exception {
- final StartMojo mojo = getStartMojo();
- // The MOJO lookup replaces a configured add-users configuration with a default value so we need to manually
- // create and insert the field for testing
- setValue(mojo, "addUser", createAddUsers("admin:admin.1234:admin", "user:user.1234:user,mgmt::true"));
- mojo.execute();
- try (ModelControllerClient client = createClient()) {
- final ServerManager serverManager = ServerManager.builder().client(client).standalone();
- // Verify the server is running
- Assert.assertTrue("The start goal did not start the server.", serverManager.isRunning());
- }
-
- final Path standaloneConfigDir = TestEnvironment.WILDFLY_HOME.resolve("standalone").resolve("configuration");
-
- // Check the management users
- final Path mgmtUsers = standaloneConfigDir.resolve("mgmt-users.properties");
- Assert.assertTrue("File " + mgmtUsers + " does not exist", Files.exists(mgmtUsers));
- Assert.assertTrue("User admin was not added to the mgmt-user.properties file", fileContains(mgmtUsers, "admin="));
-
- // Check the management users
- final Path mgmtGroups = standaloneConfigDir.resolve("mgmt-groups.properties");
- Assert.assertTrue("File " + mgmtGroups + " does not exist", Files.exists(mgmtGroups));
- Assert.assertTrue("User admin was not added to the mgmt-groups.properties file",
- fileContains(mgmtGroups, "admin=admin"));
-
- // Check the application users
- final Path appUsers = standaloneConfigDir.resolve("application-users.properties");
- Assert.assertTrue("File " + appUsers + " does not exist", Files.exists(appUsers));
- Assert.assertTrue("User user was not added to the application-user.properties file", fileContains(appUsers, "user="));
-
- // Check the management users
- final Path appGroups = standaloneConfigDir.resolve("application-roles.properties");
- Assert.assertTrue("File " + appGroups + " does not exist", Files.exists(appGroups));
- Assert.assertTrue("User user was not added to the application-roles.properties file",
- fileContains(appGroups, "user=user,mgmt"));
- }
-
- @Test
- public void testStartDomain() throws Exception {
- final StartMojo mojo = getStartMojo("start-domain-pom.xml");
- mojo.execute();
- try (DomainClient client = DomainClient.Factory.create(createClient())) {
- final ServerManager serverManager = ServerManager.builder().client(client).domain();
- // Verify the server is running
- Assert.assertTrue("The start goal did not start the server.", serverManager.isRunning());
- Assert.assertTrue("This should be a domain server server, but found a standalone server.",
- serverManager.containerDescription().isDomain());
- }
- }
-
- @Test
- public void testShutdownDomain() throws Exception {
- // Start up the server and ensure it's running
- final StartMojo startMojo = getStartMojo("start-domain-pom.xml");
- startMojo.execute();
- try (DomainClient client = DomainClient.Factory.create(createClient())) {
- final ServerManager serverManager = ServerManager.builder().client(client).domain();
- // Verify the server is running
- Assert.assertTrue("The start goal did not start the server.", serverManager.isRunning());
- }
-
- // Look up the stop mojo and attempt to stop
- final ShutdownMojo stopMojo = lookupMojoAndVerify("shutdown", "shutdown-pom.xml");
- stopMojo.execute();
- try (DomainClient client = DomainClient.Factory.create(createClient())) {
- final ServerManager serverManager = ServerManager.builder().client(client).domain();
- // Verify the server is running
- Assert.assertFalse("The start goal did not start the server.", serverManager.isRunning());
- }
- }
-
- private StartMojo getStartMojo() throws Exception {
- return getStartMojo("start-pom.xml");
- }
-
- private StartMojo getStartMojo(final String pomFile) throws Exception {
- // Start up the server and ensure it's running
- final StartMojo startMojo = lookupMojoAndVerify("start", pomFile);
- setValue(startMojo, "jbossHome", TestEnvironment.WILDFLY_HOME.toString());
- setValue(startMojo, "serverArgs",
- new String[] { "-Djboss.management.http.port=" + Integer.toString(TestEnvironment.PORT) });
- return startMojo;
- }
-
- private static ModelControllerClient createClient() throws UnknownHostException {
- return ModelControllerClient.Factory.create(TestEnvironment.HOSTNAME, TestEnvironment.PORT);
- }
-
- private static boolean fileContains(final Path path, final String text) throws IOException {
- try (BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
- String line;
- while ((line = reader.readLine()) != null) {
- if (line.startsWith(text)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static AddUser createAddUsers(final String... userStrings) throws NoSuchFieldException, IllegalAccessException {
- final AddUser result = new AddUser();
- final List users = new ArrayList<>(userStrings.length);
- for (String userString : userStrings) {
- users.add(createUser(userString));
- }
- setValue(result, "users", users);
- return result;
- }
-
- private static User createUser(final String userString) {
- final User user = new User();
- user.set(userString);
- return user;
- }
-}
diff --git a/tests/shared/src/test/resources/test-project/shutdown-pom.xml b/tests/shared/src/test/resources/test-project/shutdown-pom.xml
index 37f9187a..a50b0a6c 100644
--- a/tests/shared/src/test/resources/test-project/shutdown-pom.xml
+++ b/tests/shared/src/test/resources/test-project/shutdown-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/shared/src/test/resources/test-project/start-domain-pom.xml b/tests/shared/src/test/resources/test-project/start-domain-pom.xml
index 49223883..d6126ee0 100644
--- a/tests/shared/src/test/resources/test-project/start-domain-pom.xml
+++ b/tests/shared/src/test/resources/test-project/start-domain-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
DOMAIN
diff --git a/tests/shared/src/test/resources/test-project/start-pom.xml b/tests/shared/src/test/resources/test-project/start-pom.xml
index 9591abc6..d0e07756 100644
--- a/tests/shared/src/test/resources/test-project/start-pom.xml
+++ b/tests/shared/src/test/resources/test-project/start-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
System.out
diff --git a/tests/standalone-tests/pom.xml b/tests/standalone-tests/pom.xml
index dfa093a7..e37e6bbd 100644
--- a/tests/standalone-tests/pom.xml
+++ b/tests/standalone-tests/pom.xml
@@ -8,9 +8,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wildfly.plugins
+ org.jboss.eap.plugins
wildfly-maven-plugin-tests
- 5.1.0.Beta1-SNAPSHOT
+ 2.0.0.Final-SNAPSHOT
wildfly-maven-plugin-standalone-tests
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/ExecuteCommandsTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/ExecuteCommandsTest.java
deleted file mode 100644
index 3ff83f30..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/ExecuteCommandsTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.cli;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.apache.maven.plugin.Mojo;
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tests.TestEnvironment;
-
-public class ExecuteCommandsTest extends AbstractWildFlyServerMojoTest {
-
- @Test
- public void testExecuteCommandsFromScript() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-script-pom.xml");
- setValidSession(executeCommandsMojo);
- executeCommandsMojo.execute();
-
- // Create the address
- final ModelNode address = ServerOperations.createAddress("system-property", "org.wildfly.maven.plugin");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
-
- final ModelNode result = executeOperation(op);
- // The script adds a new system property that's value should be true
- assertEquals("true", ServerOperations.readResultAsString(result));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
-
- }
-
- @Test
- public void testExecuteCommandsFromOfflineScript() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-offline-script-pom.xml");
- setValue(executeCommandsMojo, "jbossHome", System.getProperty("jboss.home"));
- executeCommandsMojo.execute();
- }
-
- @Test
- public void testExecuteCommands() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-commands-pom.xml");
- setValidSession(executeCommandsMojo);
- executeCommandsMojo.execute();
-
- // Read the attribute
- ModelNode address = ServerOperations.createAddress("system-property", "org.wildfly.maven.plugin-exec-cmd");
- ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- ModelNode result = executeOperation(op);
- assertEquals("true", ServerOperations.readResultAsString(result));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
-
- // Read the attribute
- address = ServerOperations.createAddress("system-property", "property2");
- op = ServerOperations.createReadAttributeOperation(address, "value");
- result = executeOperation(op);
- assertEquals("property 2", ServerOperations.readResultAsString(result));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
-
- @Test
- public void testExecuteOfflineCommands() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-commands-offline-pom.xml");
- setValue(executeCommandsMojo, "jbossHome", System.getProperty("jboss.home"));
- executeCommandsMojo.execute();
- }
-
- @Test
- public void testExecuteForkCommands() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-commands-fork-pom.xml");
- setValue(executeCommandsMojo, "jbossHome", TestEnvironment.WILDFLY_HOME.toString());
-
- executeCommandsMojo.execute();
-
- // Read the attribute
- ModelNode address = ServerOperations.createAddress("system-property", "org.wildfly.maven.plugin-fork-cmd");
- ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- ModelNode result = executeOperation(op);
- assertEquals("true", ServerOperations.readResultAsString(result));
-
- // Ensure the module has been added
- final Path moduleDir = Paths.get(TestEnvironment.WILDFLY_HOME.toString(), "modules", "org", "wildfly", "plugin",
- "tests", "main");
- assertTrue(String.format("Expected %s to exist.", moduleDir), Files.exists(moduleDir));
- assertTrue("Expected the module.xml to exist in " + moduleDir, Files.exists(moduleDir.resolve("module.xml")));
- assertTrue("Expected the test.jar to exist in " + moduleDir, Files.exists(moduleDir.resolve("test.jar")));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
-
- // Read the attribute
- address = ServerOperations.createAddress("system-property", "fork-command");
- op = ServerOperations.createReadAttributeOperation(address, "value");
- result = executeOperation(op);
- assertEquals("set", ServerOperations.readResultAsString(result));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
-
- // Remove the module
- deleteRecursively(TestEnvironment.WILDFLY_HOME.resolve("modules").resolve("org"));
- }
-
- @Test
- public void testExecuteBatchCommands() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-batch-commands-pom.xml");
- setValidSession(executeCommandsMojo);
- executeCommandsMojo.execute();
-
- // Read the attribute
- final ModelNode address = ServerOperations.createAddress("system-property", "org.wildfly.maven.plugin-batch");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
- assertEquals("true", ServerOperations.readResultAsString(result));
-
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/FailOnErrorTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/FailOnErrorTest.java
deleted file mode 100644
index ae4077f4..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/cli/FailOnErrorTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.cli;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.apache.maven.plugin.Mojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tests.TestEnvironment;
-
-/**
- * @author Sven-Torben Janus
- */
-public class FailOnErrorTest extends AbstractWildFlyServerMojoTest {
-
- @Test
- public void testExecuteCommandsFailOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-commands-failOnError-pom.xml");
- setValidSession(executeCommandsMojo);
- try {
- executeCommandsMojo.execute();
- fail("MojoExecutionException expected.");
- } catch (MojoExecutionException e) {
- assertEquals("org.jboss.as.cli.CommandLineException", e.getCause().getClass().getName());
- }
- final ModelNode address = ServerOperations.createAddress("system-property", "propertyFailOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
- try {
- assertEquals("initial value", ServerOperations.readResultAsString(result));
- } finally {
- // Remove the system property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
- @Test
- public void testExecuteCommandsForkOpFailOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands",
- "execute-commands-fork-op-failOnError-pom.xml");
- // Set the JBoss home field so commands will be executed in a new process
- setValue(executeCommandsMojo, "jbossHome", TestEnvironment.WILDFLY_HOME.toString());
-
- try {
- executeCommandsMojo.execute();
- fail("MojoExecutionException expected.");
- } catch (MojoExecutionException ignore) {
- }
-
- final ModelNode address = ServerOperations.createAddress("system-property", "propertyFailOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
- try {
- assertEquals("initial value", ServerOperations.readResultAsString(result));
- } finally {
- // Remove the system property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
- @Test
- public void testExecuteCommandsForkCmdFailOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands",
- "execute-commands-fork-cmd-failOnError-pom.xml");
- // Set the JBoss home field so commands will be executed in a new process
- setValue(executeCommandsMojo, "jbossHome", TestEnvironment.WILDFLY_HOME.toString());
-
- try {
- executeCommandsMojo.execute();
- fail("MojoExecutionException expected.");
- } catch (MojoExecutionException ignore) {
- }
- // Read the attribute
- final ModelNode address = ServerOperations.createAddress("system-property", "propertyFailOnError.in.try");
- final ModelNode result = executeOperation(ServerOperations.createReadAttributeOperation(address, "value"));
-
- try {
- assertEquals("inside catch", ServerOperations.readResultAsString(result));
- } finally {
- // Remove the system property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
- @Test
- public void testExecuteCommandsContinueOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-commands-continueOnError-pom.xml");
- setValidSession(executeCommandsMojo);
- executeCommandsMojo.execute();
-
- // Read the attribute
- final ModelNode address = ServerOperations.createAddress("system-property", "propertyContinueOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
-
- try {
- assertEquals("continue on error", ServerOperations.readResultAsString(result));
- } finally {
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
- @Test
- public void testExecuteCommandsForkContinueOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands",
- "execute-commands-fork-continueOnError-pom.xml");
- // Set the JBoss home field so commands will be executed in a new process
- setValue(executeCommandsMojo, "jbossHome", TestEnvironment.WILDFLY_HOME.toString());
-
- executeCommandsMojo.execute();
-
- // Read the attribute
- final ModelNode address = ServerOperations.createAddress("system-property", "propertyContinueOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
-
- // Read the attribute
- final ModelNode inTryAddress = ServerOperations.createAddress("system-property", "propertyContinueOnError.in.try");
- final ModelNode inTryResult = executeOperation(ServerOperations.createReadAttributeOperation(inTryAddress, "value"));
-
- try {
- assertEquals("continue on error", ServerOperations.readResultAsString(result));
- assertEquals("inside catch", ServerOperations.readResultAsString(inTryResult));
-
- // The invalid module directory should not exist
- final Path baseModuleDir = Paths.get(TestEnvironment.WILDFLY_HOME.toString(), "modules", "org", "wildfly", "plugin",
- "tests");
- final Path invalidModuleDir = baseModuleDir.resolve("invalid");
- assertTrue(String.format("Expected %s to not exist.", invalidModuleDir), Files.notExists(invalidModuleDir));
-
- // The valid module directory should exist
- final Path moduleDir = baseModuleDir.resolve("main");
- assertTrue(String.format("Expected %s to exist.", moduleDir), Files.exists(moduleDir));
- assertTrue("Expected the module.xml to exist in " + moduleDir, Files.exists(moduleDir.resolve("module.xml")));
- assertTrue("Expected the test.jar to exist in " + moduleDir, Files.exists(moduleDir.resolve("test.jar")));
- } finally {
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
- executeOperation(ServerOperations.createRemoveOperation(inTryAddress));
-
- // Remove the module
- deleteRecursively(TestEnvironment.WILDFLY_HOME.resolve("modules").resolve("org"));
- }
- }
-
- @Test
- public void testExecuteCommandScriptFailOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-script-failOnError-pom.xml");
- setValidSession(executeCommandsMojo);
- try {
- executeCommandsMojo.execute();
- fail("MojoExecutionException expected.");
- } catch (MojoExecutionException e) {
- assertEquals("org.jboss.as.cli.CommandLineException", e.getCause().getClass().getName());
- }
- final ModelNode address = ServerOperations.createAddress("system-property", "scriptFailOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
- try {
- assertEquals("initial value", ServerOperations.readResultAsString(result));
- } finally {
- // Remove the system property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
- @Test
- public void testExecuteCommandScriptContinueOnError() throws Exception {
-
- final Mojo executeCommandsMojo = lookupMojoAndVerify("execute-commands", "execute-script-continueOnError-pom.xml");
- setValidSession(executeCommandsMojo);
- executeCommandsMojo.execute();
-
- // Read the attribute
- final ModelNode address = ServerOperations.createAddress("system-property", "scriptContinueOnError");
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "value");
- final ModelNode result = executeOperation(op);
-
- try {
- assertEquals("continue on error", ServerOperations.readResultAsString(result));
- } finally {
- // Clean up the property
- executeOperation(ServerOperations.createRemoveOperation(address));
- }
- }
-
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/ArtifactDeploymentTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/ArtifactDeploymentTest.java
deleted file mode 100644
index f7689f3c..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/ArtifactDeploymentTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.nio.file.Paths;
-import java.util.Collections;
-
-import javax.inject.Inject;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.jboss.dmr.ModelNode;
-import org.junit.After;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.Deployment;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * @author James R. Perkins
- */
-public class ArtifactDeploymentTest extends AbstractWildFlyServerMojoTest {
-
- private final String artifactName = "dummy.jar";
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @After
- public void cleanup() throws Exception {
- if (deploymentManager.hasDeployment(artifactName)) {
- deploymentManager.undeploy(UndeployDescription.of(artifactName));
- }
- }
-
- @Test
- public void testDeploy() throws Exception {
- final DeployArtifactMojo mojo = lookupMojoAndVerify("deploy-artifact", "deploy-artifact-pom.xml");
- testDeploy(mojo, null);
- }
-
- @Test
- public void testDeployWithClassifier() throws Exception {
- final DeployArtifactMojo mojo = lookupMojoAndVerify("deploy-artifact", "deploy-artifact-classifier-pom.xml");
- testDeploy(mojo, "classifier");
- }
-
- @Test
- public void testUndeploy() throws Exception {
- final UndeployArtifactMojo mojo = lookupMojoAndVerify("undeploy-artifact", "deploy-artifact-pom.xml");
- testUndeploy(mojo, null);
- }
-
- @Test
- public void testUndeployWithClassifier() throws Exception {
- final UndeployArtifactMojo mojo = lookupMojoAndVerify("undeploy-artifact", "deploy-artifact-classifier-pom.xml");
- testUndeploy(mojo, "classifier");
- }
-
- private void testDeploy(final DeployArtifactMojo mojo, final String classifier) throws Exception {
- if (deploymentManager.hasDeployment(artifactName)) {
- deploymentManager.undeploy(UndeployDescription.of(artifactName));
- }
- mojo.project.setDependencyArtifacts(Collections.singleton(createArtifact(classifier)));
-
- mojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + artifactName + " was not deployed", deploymentManager.hasDeployment(artifactName));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", artifactName);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- }
-
- private void testUndeploy(final UndeployArtifactMojo mojo, final String classifier) throws Exception {
- if (!deploymentManager.hasDeployment(artifactName)) {
- deploymentManager.deploy(Deployment.of(Paths.get(BASE_CONFIG_DIR, artifactName)));
- }
- mojo.project.setDependencyArtifacts(Collections.singleton(createArtifact(classifier)));
-
- mojo.execute();
-
- // Verify undeployed
- assertFalse("Deployment " + artifactName + " was not undeployed", deploymentManager.hasDeployment(artifactName));
- }
-
- private Artifact createArtifact(final String classifier) {
- final Artifact artifact = new DefaultArtifact("dummy", "dummy", "1.0.0", "provided", "jar", classifier,
- new DefaultArtifactHandler());
- artifact.setFile(new File(BASE_CONFIG_DIR, artifactName));
- return artifact;
- }
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployOnlyTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployOnlyTest.java
deleted file mode 100644
index 7ae2b5a4..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployOnlyTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.nio.file.Paths;
-
-import javax.inject.Inject;
-
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * deploy mojo testcase.
- *
- * @author Heinz Wilming
- */
-public class DeployOnlyTest extends AbstractWildFlyServerMojoTest {
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @Test
- public void testDeploy() throws Exception {
-
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy-only", "deploy-only-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- }
-
- @Test
- public void testDeployUrl() throws Exception {
-
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- final AbstractDeployment deployMojo = getUrlDeploymentMojo("deploy-only", "deploy-only-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- }
-
- @Test
- public void testRedeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("redeploy-only", "redeploy-only-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- }
-
- @Test
- public void testRedeployUrl() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final AbstractDeployment redeployMojo = getUrlDeploymentMojo("redeploy-only", "redeploy-only-webarchive-pom.xml");
-
- redeployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- }
-
- @Test
- public void testUndeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final UndeployMojo deployMojo = lookupMojoAndVerify("undeploy", "undeploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertFalse("Deployment " + DEPLOYMENT_NAME + " was not undeployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
- }
-
- private AbstractDeployment getUrlDeploymentMojo(final String goal, final String pomName) throws Exception {
- final AbstractDeployment mojo = lookupMojoAndVerify(goal, pomName);
- setValue(mojo, "contentUrl", getContentUrl());
- // Clear the target and filename to ensure they're not getting picked up
- setValue(mojo, "filename", null);
- setValue(mojo, "targetDir", null);
- return mojo;
- }
-
- private URL getContentUrl() throws MalformedURLException {
- return Paths.get(BASE_CONFIG_DIR, "target", DEPLOYMENT_NAME).toUri().toURL();
- }
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java
deleted file mode 100644
index 87865ca7..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/DeployTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import javax.inject.Inject;
-
-import org.jboss.as.controller.client.helpers.ClientConstants;
-import org.jboss.dmr.ModelNode;
-import org.junit.Test;
-import org.wildfly.plugin.common.ServerOperations;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.DeploymentManager;
-import org.wildfly.plugin.tools.UndeployDescription;
-
-/**
- * deploy mojo testcase.
- *
- * @author Heinz Wilming
- */
-public class DeployTest extends AbstractWildFlyServerMojoTest {
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @Test
- public void testDeploy() throws Exception {
-
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- @Test
- public void testForceDeploy() throws Exception {
-
- // Make sure the archive is not deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- @Test
- public void testDeployWithRuntimeName() throws Exception {
- // Make sure the archive is not deployed
- if (deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("deploy", "deploy-webarchive-with-runtime-name-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadResourceOperation(address);
- op.get(ClientConstants.INCLUDE_RUNTIME).set(true);
- final ModelNode result = executeOperation(op);
-
- if (!ServerOperations.isSuccessfulOutcome(result)) {
- fail(ServerOperations.getFailureDescriptionAsString(result));
- }
-
- assertEquals("OK", ServerOperations.readResult(result).get("status").asString());
- assertEquals("test-runtime.war", ServerOperations.readResult(result).get("runtime-name").asString());
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- @Test
- public void testRedeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final AbstractDeployment deployMojo = lookupMojoAndVerify("redeploy", "redeploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertTrue("Deployment " + DEPLOYMENT_NAME + " was not deployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
-
- // /deployment=test.war :read-attribute(name=status)
- final ModelNode address = ServerOperations.createAddress("deployment", DEPLOYMENT_NAME);
- final ModelNode op = ServerOperations.createReadAttributeOperation(address, "status");
- final ModelNode result = executeOperation(op);
-
- assertEquals("OK", ServerOperations.readResultAsString(result));
- deploymentManager.undeploy(UndeployDescription.of(DEPLOYMENT_NAME));
- }
-
- @Test
- public void testUndeploy() throws Exception {
-
- // Make sure the archive is deployed
- if (!deploymentManager.hasDeployment(DEPLOYMENT_NAME)) {
- deploymentManager.deploy(getDeployment());
- }
-
- final UndeployMojo deployMojo = lookupMojoAndVerify("undeploy", "undeploy-webarchive-pom.xml");
-
- deployMojo.execute();
-
- // Verify deployed
- assertFalse("Deployment " + DEPLOYMENT_NAME + " was not undeployed", deploymentManager.hasDeployment(DEPLOYMENT_NAME));
- }
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java
deleted file mode 100644
index 34ccff1e..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-import org.wildfly.plugin.tools.DeploymentDescription;
-import org.wildfly.plugin.tools.DeploymentManager;
-
-/**
- * Matcher Undeployment test case.
- *
- * @author Mark Paluch
- */
-public class UndeploymentMatchTest extends AbstractWildFlyServerMojoTest {
-
- @Inject
- private DeploymentManager deploymentManager;
-
- @Before
- public void before() throws Exception {
-
- deploymentManager.deploy(getDeployment().setName("test-undeploy-1.war"));
- deploymentManager.deploy(getDeployment().setName("test-undeploy-2.war"));
- }
-
- @Test
- public void undeployAll() throws Exception {
-
- undeploy(MatchPatternStrategy.ALL);
-
- final Set deployments = deploymentManager.getDeployments();
- assertEquals(0, deployments.size());
- }
-
- @Test
- public void undeployFirst() throws Exception {
-
- undeploy(MatchPatternStrategy.FIRST);
-
- final Set deployments = deploymentManager.getDeployments();
- assertEquals(1, deployments.size());
- }
-
- @Test(expected = MojoDeploymentException.class)
- public void undeployFail() throws Exception {
- undeploy(MatchPatternStrategy.FAIL);
- }
-
- @After
- public void after() throws Exception {
- undeploy(MatchPatternStrategy.ALL);
- }
-
- private void undeploy(MatchPatternStrategy matchPatternStrategy) throws Exception {
-
- final UndeployMojo undeployMojo = lookupMojoAndVerify("undeploy", "undeploy-webarchive-match-pom.xml");
-
- setValue(undeployMojo, "matchPatternStrategy", matchPatternStrategy.toString());
- undeployMojo.execute();
- }
-
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java
deleted file mode 100644
index dbe2fe32..00000000
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright The WildFly Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package org.wildfly.plugin.deployment.resources;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.wildfly.plugin.deployment.resource.AddResourceMojo;
-import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest;
-
-/**
- * AddResource test case
- *
- * @author Dave Heath
- */
-// @Ignore("Composite operations don't seem to be working with datasources")
-public class AddResourceTest extends AbstractWildFlyServerMojoTest {
-
- @Test
- public void testCanAddCompositeResource() throws Exception {
-
- final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-with-composite-pom.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
- @Test
- public void testCanAddResource() throws Exception {
-
- final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-pom.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
- @Test
- public void testCanAddXaDataSource() throws Exception {
-
- final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-xa-datasource.xml");
- try {
- addResourceMojo.execute();
- } catch (Exception ex) {
- fail(ex.getMessage());
- }
-
- }
-
-}
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/AbstractImageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/AbstractImageTest.java
index bb47afcd..52695a17 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/AbstractImageTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/AbstractImageTest.java
@@ -37,7 +37,7 @@
abstract class AbstractImageTest extends AbstractProvisionConfiguredMojoTestCase {
public AbstractImageTest() {
- super("wildfly-maven-plugin");
+ super("eap-maven-plugin");
}
@BeforeClass
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ImageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ImageTest.java
index 230659eb..379a31e1 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ImageTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ImageTest.java
@@ -16,10 +16,12 @@
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Assume;
+import org.junit.Ignore;
import org.junit.Test;
import org.wildfly.plugin.tests.AbstractWildFlyMojoTest;
import org.wildfly.plugin.tests.TestEnvironment;
+@Ignore
public class ImageTest extends AbstractImageTest {
@Test
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/LayersServerConfigImageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/LayersServerConfigImageTest.java
index 5de4de8b..3c8a01d0 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/LayersServerConfigImageTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/LayersServerConfigImageTest.java
@@ -5,9 +5,11 @@
package org.wildfly.plugin.provision;
import org.junit.Assume;
+import org.junit.Ignore;
import org.junit.Test;
import org.wildfly.plugin.tests.TestEnvironment;
+@Ignore
public class LayersServerConfigImageTest extends AbstractImageTest {
@Test
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java
index b05ac420..6114d213 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java
@@ -10,6 +10,7 @@
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.wildfly.plugin.tests.AbstractProvisionConfiguredMojoTestCase;
import org.wildfly.plugin.tests.AbstractWildFlyMojoTest;
@@ -17,7 +18,7 @@
public class PackageTest extends AbstractProvisionConfiguredMojoTestCase {
public PackageTest() {
- super("wildfly-maven-plugin");
+ super("eap-maven-plugin");
}
@Test
@@ -51,6 +52,7 @@ public void testPackageWithChannel() throws Exception {
}
@Test
+ @Ignore
public void testPackageWithChannelGlow() throws Exception {
final Mojo packageMojo = lookupConfiguredMojo(
@@ -89,6 +91,7 @@ public void testNoDeploymentPackage() throws Exception {
}
@Test
+ @Ignore
public void testGlowPackage() throws Exception {
final Mojo packageMojo = lookupConfiguredMojo(
@@ -100,6 +103,7 @@ public void testGlowPackage() throws Exception {
}
@Test
+ @Ignore
public void testGlowNoDeploymentPackage() throws Exception {
final Mojo packageMojo = lookupConfiguredMojo(
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
index 51873129..1ea72aa0 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java
@@ -14,7 +14,7 @@
public class ProvisionTest extends AbstractProvisionConfiguredMojoTestCase {
public ProvisionTest() {
- super("wildfly-maven-plugin");
+ super("eap-maven-plugin");
}
@Test
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ServerConfigImageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ServerConfigImageTest.java
index 170f4ed2..4d74353e 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ServerConfigImageTest.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ServerConfigImageTest.java
@@ -5,9 +5,11 @@
package org.wildfly.plugin.provision;
import org.junit.Assume;
+import org.junit.Ignore;
import org.junit.Test;
import org.wildfly.plugin.tests.TestEnvironment;
+@Ignore
public class ServerConfigImageTest extends AbstractImageTest {
@Test
diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/server/StandaloneTestServer.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/server/StandaloneTestServer.java
index 0537c4f1..68c865e0 100644
--- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/server/StandaloneTestServer.java
+++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/server/StandaloneTestServer.java
@@ -11,6 +11,7 @@
import org.jboss.as.controller.client.ModelControllerClient;
import org.junit.Assert;
+import org.junit.Ignore;
import org.wildfly.core.launcher.Launcher;
import org.wildfly.core.launcher.ProcessHelper;
import org.wildfly.core.launcher.StandaloneCommandBuilder;
@@ -23,6 +24,7 @@
/**
* @author James R. Perkins
*/
+@Ignore
public class StandaloneTestServer implements TestServer {
private static final AtomicBoolean STARTED = new AtomicBoolean(false);
private volatile Process currentProcess;
diff --git a/tests/standalone-tests/src/test/resources/test-project/add-resource-pom.xml b/tests/standalone-tests/src/test/resources/test-project/add-resource-pom.xml
index 189befb0..02924e37 100644
--- a/tests/standalone-tests/src/test/resources/test-project/add-resource-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/add-resource-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
subsystem=datasources
diff --git a/tests/standalone-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml b/tests/standalone-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
index 02fbac2d..ad0ce5e3 100644
--- a/tests/standalone-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
subsystem=datasources
diff --git a/tests/standalone-tests/src/test/resources/test-project/add-resource-xa-datasource.xml b/tests/standalone-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
index e76f4abe..f8b86017 100644
--- a/tests/standalone-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/add-resource-xa-datasource.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
subsystem=datasources
diff --git a/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-classifier-pom.xml b/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-classifier-pom.xml
index 0a2cc0db..58337070 100644
--- a/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-classifier-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-classifier-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
dummy
dummy
diff --git a/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-pom.xml b/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-pom.xml
index a166d0d7..0061ff9c 100644
--- a/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/deploy-artifact-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
dummy
dummy
diff --git a/tests/standalone-tests/src/test/resources/test-project/deploy-only-webarchive-pom.xml b/tests/standalone-tests/src/test/resources/test-project/deploy-only-webarchive-pom.xml
index 4f1b6bdc..4cb19e1a 100644
--- a/tests/standalone-tests/src/test/resources/test-project/deploy-only-webarchive-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/deploy-only-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-pom.xml b/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
index 546e2fc2..a2f7894a 100644
--- a/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml b/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
index 030ccb4e..00ba1211 100644
--- a/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test-runtime.war
test.war
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-batch-commands-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-batch-commands-pom.xml
index e289b9c2..60c23dcb 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-batch-commands-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-batch-commands-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-continueOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-continueOnError-pom.xml
index 91fec333..db1f2241 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-continueOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-continueOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-failOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-failOnError-pom.xml
index 3804627c..580274f3 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-failOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-failOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-cmd-failOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-cmd-failOnError-pom.xml
index 6576032a..191420c9 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-cmd-failOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-cmd-failOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-continueOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-continueOnError-pom.xml
index 424f8e9b..1f23143b 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-continueOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-continueOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-op-failOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-op-failOnError-pom.xml
index 82c0c442..5afc7e44 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-op-failOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-op-failOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-pom.xml
index 284c6833..fedd25ae 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-offline-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-offline-pom.xml
index 878628a9..a3cf47dd 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-offline-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-offline-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-commands-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-commands-pom.xml
index 306b5f5f..3959a470 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-commands-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-commands-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
/system-property=org.wildfly.maven.plugin-exec-cmd:add(value=true)
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-offline-script-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-offline-script-pom.xml
index 3a044c81..93de6647 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-offline-script-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-offline-script-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-script-continueOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-script-continueOnError-pom.xml
index f5a4efc0..dbe4e7db 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-script-continueOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-script-continueOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-script-failOnError-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-script-failOnError-pom.xml
index 1cb4e085..d6650d21 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-script-failOnError-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-script-failOnError-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/execute-script-pom.xml b/tests/standalone-tests/src/test/resources/test-project/execute-script-pom.xml
index bf4a2d50..fddb43b8 100644
--- a/tests/standalone-tests/src/test/resources/test-project/execute-script-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/execute-script-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/image-layers-server-config-pom.xml b/tests/standalone-tests/src/test/resources/test-project/image-layers-server-config-pom.xml
index d07b4fdd..435d0c88 100644
--- a/tests/standalone-tests/src/test/resources/test-project/image-layers-server-config-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/image-layers-server-config-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/image-pom.xml b/tests/standalone-tests/src/test/resources/test-project/image-pom.xml
index 2088e9d1..6208ab10 100644
--- a/tests/standalone-tests/src/test/resources/test-project/image-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/image-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/image-server-config-pom.xml b/tests/standalone-tests/src/test/resources/test-project/image-server-config-pom.xml
index a78489fe..1819ae78 100644
--- a/tests/standalone-tests/src/test/resources/test-project/image-server-config-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/image-server-config-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/image-unknown-docker-binary-pom.xml b/tests/standalone-tests/src/test/resources/test-project/image-unknown-docker-binary-pom.xml
index be628bee..64a7bfde 100644
--- a/tests/standalone-tests/src/test/resources/test-project/image-unknown-docker-binary-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/image-unknown-docker-binary-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-channel-glow-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-channel-glow-pom.xml
index ef839d3a..44b26817 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-channel-glow-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-channel-glow-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-channel-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-channel-pom.xml
index db094fb9..ccf4e6bd 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-channel-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-channel-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-default-config-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-default-config-pom.xml
index 6d060124..7ad6116e 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-default-config-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-default-config-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-glow-no-deployment-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-glow-no-deployment-pom.xml
index 21e8932d..5283c0c2 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-glow-no-deployment-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-glow-no-deployment-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
true
packaged-glow-no-deployment-server
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-glow-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-glow-pom.xml
index 4030ad8c..1ab4c51b 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-glow-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-glow-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
true
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment-pom.xml
index eb8de43a..a75c31ab 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
@@ -43,6 +43,7 @@
true
packaged-invalid-dep-server
+ true
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment2-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment2-pom.xml
index 3a0e43ee..a1a32a6a 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment2-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment2-pom.xml
@@ -14,8 +14,8 @@
foo
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
@@ -44,6 +44,7 @@
true
packaged-invalid-dep2-server
+ true
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-no-deployment-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-no-deployment-pom.xml
index b3d67600..a6b9d131 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-no-deployment-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-no-deployment-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/package-pom.xml b/tests/standalone-tests/src/test/resources/test-project/package-pom.xml
index 56028de5..ec12de70 100644
--- a/tests/standalone-tests/src/test/resources/test-project/package-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/package-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/provision-pom.xml b/tests/standalone-tests/src/test/resources/test-project/provision-pom.xml
index 2ebb4b8a..6c89b623 100644
--- a/tests/standalone-tests/src/test/resources/test-project/provision-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/provision-pom.xml
@@ -13,8 +13,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
diff --git a/tests/standalone-tests/src/test/resources/test-project/redeploy-only-webarchive-pom.xml b/tests/standalone-tests/src/test/resources/test-project/redeploy-only-webarchive-pom.xml
index 4f1b6bdc..4cb19e1a 100644
--- a/tests/standalone-tests/src/test/resources/test-project/redeploy-only-webarchive-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/redeploy-only-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/redeploy-webarchive-pom.xml b/tests/standalone-tests/src/test/resources/test-project/redeploy-webarchive-pom.xml
index 546e2fc2..a2f7894a 100644
--- a/tests/standalone-tests/src/test/resources/test-project/redeploy-webarchive-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/redeploy-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
false
diff --git a/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml b/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
index 00f3ae7c..cff484ec 100644
--- a/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
test.*.war
diff --git a/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml b/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
index 74ddb7b7..3d75a796 100644
--- a/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
+++ b/tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml
@@ -14,8 +14,8 @@
- org.wildfly.plugins
- wildfly-maven-plugin
+ org.jboss.eap.plugins
+ eap-maven-plugin
test.war
false