├── CODEOWNERS ├── tests ├── standalone-tests │ └── src │ │ └── test │ │ ├── resources │ │ ├── test-project │ │ │ ├── target │ │ │ │ ├── test.jar │ │ │ │ └── test.war │ │ │ ├── .gitignore │ │ │ ├── extra-content │ │ │ │ └── standalone │ │ │ │ │ └── configuration │ │ │ │ │ └── foo.txt │ │ │ ├── test-package.cli │ │ │ ├── dummy.jar │ │ │ ├── test.cli │ │ │ ├── dummy-test.jar │ │ │ ├── dummy-test-common.jar │ │ │ ├── failOnError.cli │ │ │ ├── continueOnError.cli │ │ │ ├── test-offline.cli │ │ │ ├── execute-script-pom.xml │ │ │ ├── execute-script-failOnError-pom.xml │ │ │ ├── undeploy-webarchive-pom.xml │ │ │ ├── deploy-webarchive-pom.xml │ │ │ ├── redeploy-webarchive-pom.xml │ │ │ ├── deploy-only-webarchive-pom.xml │ │ │ ├── redeploy-only-webarchive-pom.xml │ │ │ ├── deploy-webarchive-with-runtime-name-pom.xml │ │ │ ├── deploy-artifact-pom.xml │ │ │ ├── execute-offline-script-pom.xml │ │ │ ├── execute-script-continueOnError-pom.xml │ │ │ ├── execute-batch-commands-pom.xml │ │ │ ├── deploy-artifact-classifier-pom.xml │ │ │ ├── execute-commands-pom.xml │ │ │ ├── undeploy-webarchive-match-pom.xml │ │ │ ├── execute-commands-failOnError-pom.xml │ │ │ ├── execute-commands-fork-op-failOnError-pom.xml │ │ │ ├── execute-commands-continueOnError-pom.xml │ │ │ ├── execute-commands-fork-pom.xml │ │ │ ├── package-default-config-pom.xml │ │ │ ├── package-glow-pom.xml │ │ │ ├── execute-commands-fork-cmd-failOnError-pom.xml │ │ │ ├── execute-commands-offline-pom.xml │ │ │ ├── package-glow-no-deployment-pom.xml │ │ │ ├── provision-pom.xml │ │ │ ├── image-server-config-pom.xml │ │ │ ├── add-resource-pom.xml │ │ │ ├── image-unknown-docker-binary-pom.xml │ │ │ ├── image-layers-server-config-pom.xml │ │ │ ├── image-pom.xml │ │ │ ├── package-no-deployment-pom.xml │ │ │ ├── execute-commands-fork-continueOnError-pom.xml │ │ │ ├── package-multiple-deployments-missing-pom.xml │ │ │ ├── add-resource-xa-datasource.xml │ │ │ ├── add-resource-with-composite-pom.xml │ │ │ ├── package-channel-glow-pom.xml │ │ │ ├── package-pom.xml │ │ │ ├── package-invalid-deployment-pom.xml │ │ │ ├── package-grpc-pom.xml │ │ │ ├── package-invalid-deployment2-pom.xml │ │ │ ├── package-no-multiple-deployments-pom.xml │ │ │ ├── package-channel-pom.xml │ │ │ └── package-multiple-deployments-pom.xml │ │ └── META-INF │ │ │ └── services │ │ │ └── org.wildfly.plugin.server.TestServer │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugin │ │ ├── provision │ │ ├── ServerConfigImageTest.java │ │ ├── LayersServerConfigImageTest.java │ │ ├── ProvisionTest.java │ │ └── ImageTest.java │ │ └── deployment │ │ ├── resources │ │ └── AddResourceTest.java │ │ └── UndeploymentMatchTest.java ├── bootable-tests │ └── src │ │ └── test │ │ └── resources │ │ └── test-project │ │ ├── .gitignore │ │ ├── target │ │ └── test.war │ │ ├── package-bootable-glow-cloud-pom.xml │ │ ├── package-bootable-glow-pom.xml │ │ ├── package-bootable-root-pom.xml │ │ ├── package-bootable-pom.xml │ │ ├── package-bootable-grpc-pom.xml │ │ └── package-bootable-config-name-pom.xml ├── domain-tests │ ├── src │ │ └── test │ │ │ ├── resources │ │ │ ├── test-project │ │ │ │ ├── .gitignore │ │ │ │ ├── test-package.cli │ │ │ │ ├── target │ │ │ │ │ └── test.war │ │ │ │ ├── undeploy-webarchive-pom.xml │ │ │ │ ├── deploy-webarchive-pom.xml │ │ │ │ ├── deploy-multi-server-group-pom.xml │ │ │ │ ├── deploy-webarchive-with-runtime-name-pom.xml │ │ │ │ ├── undeploy-webarchive-match-pom.xml │ │ │ │ ├── undeploy-multi-server-group-match-pom.xml │ │ │ │ ├── provision-pom.xml │ │ │ │ ├── add-resource-pom.xml │ │ │ │ ├── add-resource-xa-datasource.xml │ │ │ │ └── add-resource-with-composite-pom.xml │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── org.wildfly.plugin.server.TestServer │ │ │ └── java │ │ │ └── org │ │ │ └── wildfly │ │ │ └── plugin │ │ │ ├── provision │ │ │ └── ProvisionTest.java │ │ │ └── deployment │ │ │ └── resources │ │ │ └── AddResourceTest.java │ └── pom.xml └── shared │ ├── src │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── wildfly │ │ │ └── plugin │ │ │ ├── categories │ │ │ ├── ChannelsRequired.java │ │ │ └── SecurityManagerRequired.java │ │ │ ├── server │ │ │ └── TestServer.java │ │ │ └── tests │ │ │ ├── AbstractWildFlyServerMojoTest.java │ │ │ └── runner │ │ │ └── WildFlyTestRunner.java │ └── test │ │ └── resources │ │ └── test-project │ │ ├── shutdown-pom.xml │ │ ├── start-pom.xml │ │ └── start-domain-pom.xml │ └── pom.xml ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── plugin └── src │ ├── site │ ├── resources │ │ ├── favicon.ico │ │ └── css │ │ │ └── custom.css │ ├── fml │ │ └── faq.fml │ ├── markdown │ │ └── channel-example.md.vm │ └── site.xml │ └── main │ └── java │ └── org │ └── wildfly │ └── plugin │ ├── server │ ├── ServerType.java │ ├── ServerContext.java │ ├── ProcessDestroyTimer.java │ └── ModulesPath.java │ ├── deployment │ ├── MatchPatternStrategy.java │ ├── MojoDeploymentException.java │ ├── RedeployOnlyMojo.java │ ├── RedeployMojo.java │ ├── DeployOnlyMojo.java │ ├── DeployMojo.java │ ├── AbstractAppDeployment.java │ ├── resource │ │ └── Resource.java │ └── DeployArtifactMojo.java │ ├── common │ └── GlowMavenMessageWriter.java │ ├── dev │ ├── ResourceHandler.java │ ├── CompiledSourceHandler.java │ ├── WatchContext.java │ ├── WatchHandler.java │ └── WebAppResourceHandler.java │ ├── provision │ └── ProvisionServerMojo.java │ └── cli │ ├── OfflineCommandExecutor.java │ ├── ScriptWriter.java │ └── CliSession.java ├── core ├── README.adoc ├── src │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugin │ │ └── core │ │ ├── Constants.java │ │ └── MavenProxySelector.java └── pom.xml ├── .gitignore ├── .github ├── dependabot.yml └── workflows │ ├── generate-and-deploy-site.yml │ ├── wildfly-build.yml │ ├── nightly-ci.yml │ └── ci.yml ├── dco.txt ├── SECURITY.md ├── README.adoc └── CONTRIBUTING.adoc /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @jamezp -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/target/test.jar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/.gitignore: -------------------------------------------------------------------------------- 1 | # Include the test target directory 2 | !target/ -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/.gitignore: -------------------------------------------------------------------------------- 1 | # Include the test target directory 2 | !target/ -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/.gitignore: -------------------------------------------------------------------------------- 1 | # Include the test target directory 2 | !target/ -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/extra-content/standalone/configuration/foo.txt: -------------------------------------------------------------------------------- 1 | 2 | # To add to the server. -------------------------------------------------------------------------------- /plugin/src/site/resources/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/plugin/src/site/resources/favicon.ico -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/test-package.cli: -------------------------------------------------------------------------------- 1 | /system-property=org.wildfly.maven.plugin-package-goal-from-script:add(value=true) 2 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/test-package.cli: -------------------------------------------------------------------------------- 1 | /system-property=org.wildfly.maven.plugin-package-goal-from-script:add(value=true) 2 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/dummy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/standalone-tests/src/test/resources/test-project/dummy.jar -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/target/test.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/domain-tests/src/test/resources/test-project/target/test.war -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/test.cli: -------------------------------------------------------------------------------- 1 | batch 2 | # Add a system property 3 | /system-property=org.wildfly.maven.plugin:add(value=true) 4 | #... 5 | # Execute 6 | run-batch -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/target/test.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/bootable-tests/src/test/resources/test-project/target/test.war -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/dummy-test.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/standalone-tests/src/test/resources/test-project/dummy-test.jar -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/target/test.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/standalone-tests/src/test/resources/test-project/target/test.war -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/dummy-test-common.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly/wildfly-maven-plugin/HEAD/tests/standalone-tests/src/test/resources/test-project/dummy-test-common.jar -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/META-INF/services/org.wildfly.plugin.server.TestServer: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright The WildFly Authors 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | org.wildfly.plugin.server.DomainTestServer -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/META-INF/services/org.wildfly.plugin.server.TestServer: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright The WildFly Authors 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | org.wildfly.plugin.server.StandaloneTestServer -------------------------------------------------------------------------------- /core/README.adoc: -------------------------------------------------------------------------------- 1 | = WildFly Plugins Core API 2 | 3 | The WildFly Plugins Core API offers some simple API's for deploying applications to http://wildfly.org[WildFly] or https://www.redhat.com/en/technologies/jboss-middleware/application-platform[JBoss EAP]. -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/failOnError.cli: -------------------------------------------------------------------------------- 1 | /system-property=scriptFailOnError:add(value="initial value") 2 | /system-property=scriptFailOnError:add(value="fail on error") 3 | /system-property=scriptFailOnError:write-attribute(name=value, value="should not be set") -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/continueOnError.cli: -------------------------------------------------------------------------------- 1 | /system-property=scriptContinueOnError:add(value="initial value") 2 | /system-property=scriptContinueOnError:add(value="second value") 3 | /system-property=scriptContinueOnError:write-attribute(name=value, value="continue on error") -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/test-offline.cli: -------------------------------------------------------------------------------- 1 | embed-server --server-config=standalone.xml 2 | /system-property=offline-property:add(value=true) 3 | #... 4 | # Execute 5 | stop-embedded-server 6 | embed-server --server-config=standalone.xml 7 | /system-property=offline-property:remove 8 | stop-embedded-server -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright The WildFly Authors 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip 6 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 7 | -------------------------------------------------------------------------------- /tests/shared/src/main/java/org/wildfly/plugin/categories/ChannelsRequired.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.categories; 7 | 8 | /** 9 | * @author James R. Perkins 10 | */ 11 | public interface ChannelsRequired { 12 | } 13 | -------------------------------------------------------------------------------- /tests/shared/src/main/java/org/wildfly/plugin/categories/SecurityManagerRequired.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.categories; 7 | 8 | /** 9 | * @author James R. Perkins 10 | */ 11 | public interface SecurityManagerRequired { 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/server/ServerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.server; 7 | 8 | /** 9 | * The type of server. 10 | * 11 | * @author James R. Perkins 12 | */ 13 | public enum ServerType { 14 | STANDALONE, 15 | DOMAIN 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Ignore Maven target folder 2 | target/ 3 | 4 | # Formatting cache 5 | .cache/ 6 | 7 | #Ignore Eclipse files 8 | .settings/ 9 | .classpath 10 | .project 11 | 12 | #Ignore Intellij files 13 | *.iml 14 | *.iws 15 | *.ipr 16 | .idea/ 17 | 18 | #Ignore Mac files 19 | .DS_Store 20 | nb-configuration.xml 21 | 22 | # Maven site files 23 | **/velocity.log 24 | 25 | # Release files 26 | *.releaseBackup 27 | release.properties -------------------------------------------------------------------------------- /tests/shared/src/main/java/org/wildfly/plugin/server/TestServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.server; 7 | 8 | import org.jboss.as.controller.client.ModelControllerClient; 9 | import org.wildfly.plugin.tools.DeploymentManager; 10 | 11 | /** 12 | * @author James R. Perkins 13 | */ 14 | public interface TestServer { 15 | 16 | void start(); 17 | 18 | void stop(); 19 | 20 | ModelControllerClient getClient(); 21 | 22 | DeploymentManager getDeploymentManager(); 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/org/wildfly/plugin/core/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.core; 6 | 7 | /** 8 | * @author jdenise 9 | */ 10 | public interface Constants { 11 | 12 | String CLI_RESOLVE_PARAMETERS_VALUES = "--resolve-parameter-values"; 13 | String CLI_ECHO_COMMAND_ARG = "--echo-command"; 14 | String PLUGIN_PROVISIONING_FILE = ".wildfly-maven-plugin-provisioning.xml"; 15 | String STANDALONE = "standalone"; 16 | String STANDALONE_XML = "standalone.xml"; 17 | String FORK_EMBEDDED_PROCESS_OPTION = "jboss-fork-embedded"; 18 | } 19 | -------------------------------------------------------------------------------- /tests/shared/src/test/resources/test-project/shutdown-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/MatchPatternStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | /** 9 | * The strategy used when using a pattern to undeploy deployments. 10 | * 11 | * @author Mark Paluch 12 | * @since 27.06.13 08:08 13 | */ 14 | public enum MatchPatternStrategy { 15 | /** 16 | * Undeploy the first matching deployment. The first deployment is determined by 17 | * {@linkplain Comparable natural ordering} of the deployment names. 18 | */ 19 | FIRST, 20 | /** 21 | * Undeploy all deployments matching the pattern. 22 | */ 23 | ALL, 24 | /** 25 | * Fail if more than one deployment matches the pattern. 26 | */ 27 | FAIL 28 | } 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ServerConfigImageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import org.junit.Assume; 8 | import org.junit.Test; 9 | import org.junit.experimental.categories.Category; 10 | import org.wildfly.plugin.categories.ChannelsRequired; 11 | import org.wildfly.plugin.tests.TestEnvironment; 12 | 13 | @Category(ChannelsRequired.class) 14 | public class ServerConfigImageTest extends AbstractImageTest { 15 | 16 | @Test 17 | public void serverConfig() throws Exception { 18 | Assume.assumeFalse("This test is flaky on Windows, ignore it on Windows.", TestEnvironment.isWindows()); 19 | assertConfigFileName("image-server-config", "SERVER_ARGS=-c=standalone-microprofile.xml"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/LayersServerConfigImageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import org.junit.Assume; 8 | import org.junit.Test; 9 | import org.junit.experimental.categories.Category; 10 | import org.wildfly.plugin.categories.ChannelsRequired; 11 | import org.wildfly.plugin.tests.TestEnvironment; 12 | 13 | @Category(ChannelsRequired.class) 14 | public class LayersServerConfigImageTest extends AbstractImageTest { 15 | 16 | @Test 17 | public void layersConfigurationFileName() throws Exception { 18 | Assume.assumeFalse("This test is flaky on Windows, ignore it on Windows.", TestEnvironment.isWindows()); 19 | assertConfigFileName("image-layers-server-config", "SERVER_ARGS=-c=standalone-core.xml"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "maven" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | ignore: 13 | - dependency-name: 'javax.inject:javax.inject' 14 | update-types: ['version-update:semver-major'] 15 | rebase-strategy: disabled 16 | open-pull-requests-limit: 10 17 | - package-ecosystem: "github-actions" 18 | # Workflow files stored in the 19 | # default location of `.github/workflows` 20 | directory: "/" 21 | schedule: 22 | interval: "daily" 23 | open-pull-requests-limit: 10 24 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/server/ServerContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.server; 7 | 8 | import java.nio.file.Path; 9 | 10 | import org.wildfly.core.launcher.CommandBuilder; 11 | 12 | /** 13 | * The context of a server that has been started. 14 | * 15 | * @author James R. Perkins 16 | */ 17 | public interface ServerContext { 18 | 19 | /** 20 | * The running process. 21 | * 22 | * @return the process 23 | */ 24 | Process process(); 25 | 26 | /** 27 | * The command builder used to start the server. 28 | * 29 | * @return the command builder 30 | */ 31 | CommandBuilder commandBuilder(); 32 | 33 | /** 34 | * The directory used to start the server. 35 | * 36 | * @return the server directory 37 | */ 38 | Path jbossHome(); 39 | } 40 | -------------------------------------------------------------------------------- /tests/shared/src/test/resources/test-project/start-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | System.out 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/common/GlowMavenMessageWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.common; 6 | 7 | import org.apache.maven.plugin.logging.Log; 8 | import org.wildfly.glow.GlowMessageWriter; 9 | 10 | /** 11 | * 12 | * @author jdenise 13 | */ 14 | public class GlowMavenMessageWriter implements GlowMessageWriter { 15 | 16 | private final Log log; 17 | 18 | GlowMavenMessageWriter(Log log) { 19 | this.log = log; 20 | } 21 | 22 | @Override 23 | public void info(Object s) { 24 | log.info(s.toString()); 25 | } 26 | 27 | @Override 28 | public void warn(Object s) { 29 | log.warn(s.toString()); 30 | } 31 | 32 | @Override 33 | public void error(Object s) { 34 | log.error(s.toString()); 35 | } 36 | 37 | @Override 38 | public void trace(Object s) { 39 | log.debug(s.toString()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-script-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-script-failOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/redeploy-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/dev/ResourceHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.dev; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | import java.nio.file.WatchEvent; 11 | 12 | /** 13 | * @author James R. Perkins 14 | */ 15 | class ResourceHandler implements WatchHandler { 16 | 17 | @Override 18 | public Result handle(final WatchContext context, final WatchEvent event, final Path file) throws IOException { 19 | return new Result() { 20 | @Override 21 | public boolean requiresCopyResources() { 22 | return true; 23 | } 24 | 25 | @Override 26 | public boolean requiresRepackage() { 27 | return true; 28 | } 29 | 30 | @Override 31 | public boolean requiresRedeploy() { 32 | return true; 33 | } 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /plugin/src/site/resources/css/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | 7 | a { 8 | color: #f0ca4d !important; 9 | } 10 | 11 | a:hover { 12 | color: #fff !important; 13 | } 14 | 15 | .navbar-text { 16 | color: #aaa !important; 17 | } 18 | 19 | .commonhaus-footer .commonhaus-logo { 20 | grid-column: 7/13; 21 | grid-row: 1; 22 | justify-self: center; 23 | align-self: center 24 | } 25 | 26 | .commonhaus-footer .commonhaus-logo img { 27 | height: 30px 28 | } 29 | 30 | @media screen and (max-width: 1024px) { 31 | .commonhaus-footer .commonhaus-logo { 32 | grid-column: 6/12; 33 | justify-self: center 34 | } 35 | } 36 | 37 | @media screen and (max-width: 768px) { 38 | .commonhaus-footer .commonhaus-logo { 39 | grid-column: 5/11 40 | } 41 | } 42 | 43 | @media screen and (max-width: 480px) { 44 | .commonhaus-footer .commonhaus-logo { 45 | grid-column: 1/13; 46 | justify-self: center; 47 | order: 1 48 | } 49 | } -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/deploy-only-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/redeploy-only-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | false 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test-runtime.war 21 | test.war 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/deploy-artifact-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | dummy 21 | dummy 22 | dummy.jar 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-offline-script-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/server/ProcessDestroyTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.server; 7 | 8 | import java.util.concurrent.TimeUnit; 9 | 10 | /** 11 | * @author James R. Perkins 12 | */ 13 | class ProcessDestroyTimer extends Thread { 14 | private final Process process; 15 | private final long timeout; 16 | 17 | ProcessDestroyTimer(final Process process, final long timeout) { 18 | this.process = process; 19 | this.timeout = timeout; 20 | } 21 | 22 | static ProcessDestroyTimer start(final Process process, final long timeout) { 23 | final ProcessDestroyTimer result = new ProcessDestroyTimer(process, timeout); 24 | result.start(); 25 | return result; 26 | } 27 | 28 | @Override 29 | public void run() { 30 | try { 31 | TimeUnit.SECONDS.sleep(timeout); 32 | process.destroy(); 33 | } catch (InterruptedException ignore) { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-script-continueOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | false 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | 22 | main-server-group 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-batch-commands-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | 21 | /system-property=org.wildfly.maven.plugin-batch:add(value=true) 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/deploy-webarchive-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | 22 | main-server-group 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/shared/src/test/resources/test-project/start-domain-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | 21 | DOMAIN 22 | System.out 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/deploy-artifact-classifier-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | dummy 21 | dummy 22 | classifier 23 | dummy.jar 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/dev/CompiledSourceHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.dev; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | import java.nio.file.WatchEvent; 11 | 12 | import org.apache.maven.plugin.MojoExecutionException; 13 | 14 | /** 15 | * @author James R. Perkins 16 | */ 17 | class CompiledSourceHandler implements WatchHandler { 18 | 19 | @Override 20 | public Result handle(final WatchContext context, final WatchEvent event, final Path file) 21 | throws IOException, MojoExecutionException { 22 | return new Result() { 23 | @Override 24 | public boolean requiresRecompile() { 25 | return true; 26 | } 27 | 28 | @Override 29 | public boolean requiresRedeploy() { 30 | return true; 31 | } 32 | 33 | @Override 34 | public boolean requiresRepackage() { 35 | return true; 36 | } 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | /system-property=org.wildfly.maven.plugin-exec-cmd:add(value=true) 21 | /system-property=property2:add(value="property 2") 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | test.*.war 22 | all 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/deploy-multi-server-group-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | 22 | main-server-group 23 | other-server-group 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/deploy-webarchive-with-runtime-name-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test-runtime.war 21 | test.war 22 | 23 | main-server-group 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import java.nio.file.Path; 8 | 9 | import org.apache.maven.plugin.Mojo; 10 | import org.junit.Test; 11 | import org.junit.experimental.categories.Category; 12 | import org.wildfly.plugin.categories.ChannelsRequired; 13 | import org.wildfly.plugin.tests.AbstractProvisionConfiguredMojoTestCase; 14 | import org.wildfly.plugin.tests.AbstractWildFlyMojoTest; 15 | 16 | @Category(ChannelsRequired.class) 17 | public class ProvisionTest extends AbstractProvisionConfiguredMojoTestCase { 18 | 19 | public ProvisionTest() { 20 | super("wildfly-maven-plugin"); 21 | } 22 | 23 | @Test 24 | public void testProvision() throws Exception { 25 | 26 | final Mojo provisionMojo = lookupConfiguredMojo(AbstractWildFlyMojoTest.getPomFile("provision-pom.xml").toFile(), 27 | "provision"); 28 | 29 | provisionMojo.execute(); 30 | Path jbossHome = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("server"); 31 | checkDomainWildFlyHome(jbossHome, 0, false); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-failOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | 21 | /system-property=propertyFailOnError:add(value="initial value") 22 | /system-property=propertyFailOnError:add(value="fail on error") 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ProvisionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import java.nio.file.Path; 8 | 9 | import org.apache.maven.plugin.Mojo; 10 | import org.junit.Test; 11 | import org.junit.experimental.categories.Category; 12 | import org.wildfly.plugin.categories.ChannelsRequired; 13 | import org.wildfly.plugin.tests.AbstractProvisionConfiguredMojoTestCase; 14 | import org.wildfly.plugin.tests.AbstractWildFlyMojoTest; 15 | 16 | @Category(ChannelsRequired.class) 17 | public class ProvisionTest extends AbstractProvisionConfiguredMojoTestCase { 18 | 19 | public ProvisionTest() { 20 | super("wildfly-maven-plugin"); 21 | } 22 | 23 | @Test 24 | public void testProvision() throws Exception { 25 | 26 | final Mojo provisionMojo = lookupConfiguredMojo(AbstractWildFlyMojoTest.getPomFile("provision-pom.xml").toFile(), 27 | "provision"); 28 | 29 | provisionMojo.execute(); 30 | Path jbossHome = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("provisioned-server"); 31 | checkStandaloneWildFlyHome(jbossHome, 0, null, null, false); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/undeploy-webarchive-match-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | test.*.war 22 | all 23 | 24 | main-server-group 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-op-failOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | true 21 | 22 | /system-property=propertyFailOnError:add(value="initial value") 23 | /system-property=propertyFailOnError:add(value="fail on error") 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/provision/ProvisionServerMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import java.io.IOException; 8 | import java.nio.file.Path; 9 | 10 | import org.apache.maven.plugin.MojoExecutionException; 11 | import org.apache.maven.plugin.MojoFailureException; 12 | import org.apache.maven.plugins.annotations.LifecyclePhase; 13 | import org.apache.maven.plugins.annotations.Mojo; 14 | import org.apache.maven.plugins.annotations.ResolutionScope; 15 | import org.wildfly.plugin.tools.GalleonUtils; 16 | 17 | /** 18 | * Provision a server. 19 | * 20 | * @author jfdenise 21 | * @since 3.0 22 | */ 23 | @Mojo(name = "provision", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PACKAGE) 24 | public class ProvisionServerMojo extends AbstractProvisionServerMojo { 25 | 26 | @Override 27 | protected String getGoal() { 28 | return "provision"; 29 | } 30 | 31 | @Override 32 | protected void serverProvisioned(Path jbossHome) throws MojoExecutionException, MojoFailureException { 33 | try { 34 | GalleonUtils.cleanupServer(jbossHome); 35 | } catch (IOException ex) { 36 | throw new MojoExecutionException(ex); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/undeploy-multi-server-group-match-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | war 12 | 0.1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | test.war 21 | test.*.war 22 | all 23 | 24 | main-server-group 25 | other-server-group 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/MojoDeploymentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import org.apache.maven.plugin.MojoExecutionException; 9 | 10 | /** 11 | * Wrapped exception for {@link MojoExecutionException}. 12 | * 13 | * @author James R. Perkins 14 | */ 15 | public class MojoDeploymentException extends MojoExecutionException { 16 | 17 | public MojoDeploymentException(final String message, final Exception cause) { 18 | super(message, cause); 19 | } 20 | 21 | public MojoDeploymentException(final Exception cause, final String format, final Object... args) { 22 | this(String.format(format, args), cause); 23 | } 24 | 25 | public MojoDeploymentException(final String message, final Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | public MojoDeploymentException(final Throwable cause, final String format, final Object... args) { 30 | this(String.format(format, args), cause); 31 | } 32 | 33 | public MojoDeploymentException(final String message) { 34 | super(message); 35 | } 36 | 37 | public MojoDeploymentException(final String format, final Object... args) { 38 | this(String.format(format, args)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-continueOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | false 20 | 21 | /system-property=propertyContinueOnError:add(value="initial value") 22 | /system-property=propertyContinueOnError:add(value="second value") 23 | /system-property=propertyContinueOnError:write-attribute(name=value, value="continue on error") 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | 21 | /system-property=org.wildfly.maven.plugin-fork-cmd:add(value=true) 22 | /system-property=fork-command:add(value="set") 23 | module add --name=org.wildfly.plugin.tests --dependencies=org.jboss.logging --resources=${project.build.directory}${file.separator}test.jar 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/dev/WatchContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.dev; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | import java.nio.file.WatchEvent; 11 | 12 | import org.apache.maven.plugin.MojoExecutionException; 13 | 14 | /** 15 | * @author James R. Perkins 16 | */ 17 | class WatchContext implements Comparable { 18 | private final Path directory; 19 | private final WatchHandler handler; 20 | 21 | private WatchContext(final Path directory, final WatchHandler handler) { 22 | this.directory = directory; 23 | this.handler = handler; 24 | } 25 | 26 | static WatchContext of(final Path directory, final WatchHandler handler) { 27 | return new WatchContext(directory, handler); 28 | } 29 | 30 | Path directory() { 31 | return directory; 32 | } 33 | 34 | WatchHandler handler() { 35 | return handler; 36 | } 37 | 38 | // TODO (jrp) should this just go away? 39 | WatchHandler.Result handle(final WatchEvent event, final Path file) throws MojoExecutionException, IOException { 40 | return handler.handle(this, event, directory.resolve(file)); 41 | } 42 | 43 | @Override 44 | public int compareTo(final WatchContext o) { 45 | return directory().compareTo(o.directory()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-cloud-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | test.war 20 | true 21 | packaged-bootable-glow-server 22 | true 23 | server-bootable.jar 24 | 25 | cloud 26 | WF_VERSION 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /dco.txt: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 1 Letterman Drive 6 | Suite D4700 7 | San Francisco, CA, 94129 8 | 9 | Everyone is permitted to copy and distribute verbatim copies of this 10 | license document, but changing it is not allowed. 11 | 12 | 13 | Developer's Certificate of Origin 1.1 14 | 15 | By making a contribution to this project, I certify that: 16 | 17 | (a) The contribution was created in whole or in part by me and I 18 | have the right to submit it under the open source license 19 | indicated in the file; or 20 | 21 | (b) The contribution is based upon previous work that, to the best 22 | of my knowledge, is covered under an appropriate open source 23 | license and I have the right under that license to submit that 24 | work with modifications, whether created in whole or in part 25 | by me, under the same open source license (unless I am 26 | permitted to submit under a different license), as indicated 27 | in the file; or 28 | 29 | (c) The contribution was provided directly to me by some other 30 | person who certified (a), (b) or (c) and I have not modified 31 | it. 32 | 33 | (d) I understand and agree that this project and the contribution 34 | are public and that a record of the contribution (including all 35 | personal information I submit with it, including my sign-off) is 36 | maintained indefinitely and may be redistributed consistent with 37 | this project or the open source license(s) involved. 38 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-glow-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | test.war 20 | true 21 | packaged-bootable-glow-server 22 | true 23 | server-bootable.jar 24 | 25 | 26 | openapi 27 | 28 | WF_VERSION 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-default-config-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | true 25 | packaged-default-config-server 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/server/ModulesPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.server; 7 | 8 | import java.io.File; 9 | import java.util.ArrayList; 10 | import java.util.Collection; 11 | import java.util.Collections; 12 | 13 | import org.apache.maven.plugins.annotations.Parameter; 14 | 15 | /** 16 | * Represents a module path element. 17 | *

18 | * Guarded by {@code this}. 19 | * 20 | * @author James R. Perkins 21 | */ 22 | public class ModulesPath { 23 | 24 | /** 25 | * Defines a list of paths to be used for the modules path. 26 | */ 27 | @Parameter(alias = "paths") 28 | private File[] paths; 29 | 30 | private File modulePath; 31 | 32 | public Collection getModulePaths() { 33 | if (paths == null && modulePath == null) { 34 | return Collections.emptyList(); 35 | } 36 | final Collection result = new ArrayList<>(); 37 | if (modulePath != null) { 38 | result.add(modulePath.getAbsolutePath()); 39 | } 40 | if (paths != null) { 41 | for (File path : paths) { 42 | result.add(path.getAbsolutePath()); 43 | } 44 | } 45 | return result; 46 | } 47 | 48 | /** 49 | * Sets the modules path. Used for Maven to allow a single path to be set. 50 | * 51 | * @param modulePath the module path to set 52 | */ 53 | public synchronized void set(final File modulePath) { 54 | this.modulePath = modulePath; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/provision-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | true 23 | true 24 | 25 | 26 | false 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-glow-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | test.war 20 | true 21 | packaged-glow-server 22 | 23 | 24 | openapi 25 | 26 | WF_VERSION 27 | 28 | 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-cmd-failOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | true 21 | 22 | try 23 | /system-property=propertyFailOnError.in.try:add(value="initial value") 24 | /system-property=propertyFailOnError.in.try:add(value="second value") 25 | catch 26 | /system-property=propertyFailOnError.in.try:write-attribute(name=value, value="inside catch") 27 | end-try 28 | read-attribute invalid 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-offline-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | 21 | embed-server 22 | /system-property=org.wildfly.maven.plugin-offline-cmd:add(value=true) 23 | /system-property=local-command:add(value="set") 24 | stop-embedded-server 25 | embed-server 26 | /system-property=org.wildfly.maven.plugin-offline-cmd:read-resource 27 | /system-property=org.wildfly.maven.plugin-offline-cmd:remove 28 | stop-embedded-server 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/RedeployOnlyMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.net.URL; 9 | 10 | import org.apache.maven.plugins.annotations.Execute; 11 | import org.apache.maven.plugins.annotations.LifecyclePhase; 12 | import org.apache.maven.plugins.annotations.Mojo; 13 | import org.apache.maven.plugins.annotations.Parameter; 14 | import org.wildfly.plugin.common.PropertyNames; 15 | import org.wildfly.plugin.tools.Deployment; 16 | 17 | /** 18 | * Redeploys only the application to the WildFly Application Server without first invoking the 19 | * the execution of the lifecycle phase 'package' prior to executing itself. 20 | */ 21 | @Mojo(name = "redeploy-only", threadSafe = true) 22 | @Execute(phase = LifecyclePhase.NONE) 23 | public class RedeployOnlyMojo extends RedeployMojo { 24 | 25 | /** 26 | * A URL representing the a path to the content to be redeployed. The server the content is being redeployed to will 27 | * require access to the URL. 28 | *

29 | * If defined this overrides the {@code filename} and {@code targetDir} configuration parameters. 30 | *

31 | */ 32 | @Parameter(alias = "content-url", property = PropertyNames.DEPLOYMENT_CONTENT_URL) 33 | private URL contentUrl; 34 | 35 | @Override 36 | public String goal() { 37 | return "redeploy"; 38 | } 39 | 40 | @Override 41 | protected Deployment createDeployment() { 42 | if (contentUrl == null) { 43 | return super.createDeployment(); 44 | } 45 | return Deployment.of(contentUrl); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-glow-no-deployment-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | packaged-glow-no-deployment-server 21 | 22 | 23 | openapi 24 | 25 | true 26 | WF_VERSION 27 | 28 | 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/provision-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | false 28 | provisioned-server 29 | 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/image-server-config-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | image-server-config 25 | test.war 26 | wildfly-image-server-config-maven-plugin 27 | standalone-microprofile.xml 28 | 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/RedeployMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.io.IOException; 9 | 10 | import org.apache.maven.plugins.annotations.Execute; 11 | import org.apache.maven.plugins.annotations.LifecyclePhase; 12 | import org.apache.maven.plugins.annotations.Mojo; 13 | import org.apache.maven.plugins.annotations.ResolutionScope; 14 | import org.wildfly.plugin.tools.Deployment; 15 | import org.wildfly.plugin.tools.DeploymentManager; 16 | import org.wildfly.plugin.tools.DeploymentResult; 17 | 18 | /** 19 | * Redeploys the application to the WildFly Application Server. 20 | * 21 | * @author James R. Perkins 22 | */ 23 | @Mojo(name = "redeploy", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) 24 | @Execute(phase = LifecyclePhase.PACKAGE) 25 | public class RedeployMojo extends AbstractAppDeployment { 26 | 27 | @Override 28 | public String goal() { 29 | return "redeploy"; 30 | } 31 | 32 | @Override 33 | protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment) 34 | throws IOException, MojoDeploymentException { 35 | // Ensure the deployment exists before attempting to redeploy it 36 | if (!deploymentManager.hasDeployment(deployment.getName())) { 37 | throw new MojoDeploymentException( 38 | "The deployment %s does not exist in the content repository and cannot be redeployed.", 39 | deployment.getName()); 40 | } 41 | return deploymentManager.redeploy(deployment); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/add-resource-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 |
subsystem=datasources
20 | 21 | 22 |
data-source=java:/ds-name1
23 | 24 | java:jboss/ds-name1 25 | true 26 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 27 | org.h2.Driver 28 | h2 29 | sa 30 | sa 31 | 32 |
33 |
34 |
35 |
36 |
37 |
38 | 39 |
-------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/image-unknown-docker-binary-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | image-server 28 | wildfly-maven-plugin 29 | focker-is-not-docker 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting of CVEs and Security Issues 2 | 3 | ## The WildFly community and our sponsor, Red Hat, take security bugs very seriously 4 | 5 | We aim to take immediate action to address serious security-related problems that involve our projects. 6 | 7 | Note that we will only fix such issues in the most recent minor release of WildFly. 8 | 9 | ## Reporting of Security Issues 10 | 11 | When reporting a security vulnerability it is important to not accidentally broadcast to the world that the issue exists, as this makes it easier for people to exploit it. The software industry uses the term embargo to describe the time a security issue is known internally until it is public knowledge. 12 | 13 | Our preferred way of reporting security issues in WildFly and its related projects is listed below. 14 | 15 | ### Email the mailing list 16 | 17 | The list at security@wildfly.org is the preferred mechanism for outside users to report security issues. A member of the WildFly team will open the required issues. 18 | 19 | ### Other considerations 20 | 21 | If you would like to work with us on a fix for the security vulnerability, please include your GitHub username in the above email, and we will provide you access to a temporary private fork where we can collaborate on a fix without it being disclosed publicly, **including in your own publicly visible git repository**. 22 | 23 | Do not open a public issue, send a pull request, or disclose any information about the suspected vulnerability publicly, **including in your own publicly visible git repository**. If you discover any publicly disclosed security vulnerabilities, please notify us immediately through security@wildfly.org 24 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment.resources; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | import org.junit.Test; 11 | import org.wildfly.plugin.deployment.resource.AddResourceMojo; 12 | import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest; 13 | 14 | /** 15 | * AddResource test case 16 | * 17 | * @author Dave Heath 18 | */ 19 | // @Ignore("Composite operations don't seem to be working with datasources") 20 | public class AddResourceTest extends AbstractWildFlyServerMojoTest { 21 | 22 | @Test 23 | public void testCanAddCompositeResource() throws Exception { 24 | 25 | final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-with-composite-pom.xml"); 26 | try { 27 | addResourceMojo.execute(); 28 | } catch (Exception ex) { 29 | fail(ex.getMessage()); 30 | } 31 | 32 | } 33 | 34 | @Test 35 | public void testCanAddResource() throws Exception { 36 | 37 | final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-pom.xml"); 38 | try { 39 | addResourceMojo.execute(); 40 | } catch (Exception ex) { 41 | fail(ex.getMessage()); 42 | } 43 | 44 | } 45 | 46 | @Test 47 | public void testCanAddXaDataSource() throws Exception { 48 | 49 | final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", "add-resource-xa-datasource.xml"); 50 | try { 51 | addResourceMojo.execute(); 52 | } catch (Exception ex) { 53 | fail(ex.getMessage()); 54 | } 55 | 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/add-resource-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | full 21 | 22 |
subsystem=datasources
23 | 24 | 25 |
data-source=java:/ds-name1
26 | 27 | java:jboss/ds-name1 28 | true 29 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 30 | org.h2.Driver 31 | h2 32 | sa 33 | sa 34 | 35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
-------------------------------------------------------------------------------- /.github/workflows/generate-and-deploy-site.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Generate and deploy the site 3 | 4 | on: 5 | # Runs on pushes version tags 6 | push: 7 | tags: 8 | - v* 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 14 | permissions: 15 | contents: read 16 | pages: write 17 | id-token: write 18 | 19 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 20 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 21 | concurrency: 22 | group: 'pages' 23 | cancel-in-progress: false 24 | 25 | jobs: 26 | # Generate the site 27 | generate-site: 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Checkout 31 | uses: actions/checkout@v6 32 | - name: Setup Pages 33 | id: pages 34 | uses: actions/configure-pages@v5 35 | - name: Set up JDK 21 36 | uses: actions/setup-java@v5 37 | with: 38 | java-version: 21 39 | cache: 'maven' 40 | distribution: 'temurin' 41 | - name: Generate JavaDoc 42 | run: | 43 | cd plugin 44 | mvn -B -ntp clean -Pjboss-release site 45 | - name: Upload artifact 46 | uses: actions/upload-pages-artifact@v4 47 | with: 48 | # Upload the site 49 | path: 'plugin/target/site/' 50 | # Single deploy job since we're just deploying 51 | deploy: 52 | environment: 53 | name: github-pages 54 | url: ${{ steps.deployment.outputs.page_url }} 55 | runs-on: ubuntu-latest 56 | needs: generate-site 57 | steps: 58 | - name: Deploy to GitHub Pages 59 | id: deployment 60 | uses: actions/deploy-pages@v4 61 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/image-layers-server-config-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | image-layers-server-config 28 | test.war 29 | wildfly-image-layers-server-config-maven-plugin 30 | standalone-core.xml 31 | 32 | 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-root-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | ROOT.war 28 | true 29 | packaged-root-bootable-server 30 | true 31 | jar-root.jar 32 | 33 | 34 | true 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 4.0.0 9 | 10 | org.wildfly.plugins 11 | wildfly-maven-plugin-parent 12 | 6.0.0.Beta1-SNAPSHOT 13 | 14 | 15 | wildfly-plugin-core 16 | WildFly Plugin Core Utilities 17 | 18 | 19 | Utilities for Maven plugins to interact with WildFly. 20 | 21 | 22 | 23 | 24 | org.apache.maven 25 | maven-core 26 | provided 27 | 28 | 29 | org.jboss.logging 30 | jboss-logging 31 | 32 | 33 | org.apache.maven.shared 34 | maven-artifact-transfer 35 | 36 | 37 | 38 | 39 | 40 | 41 | maven-jar-plugin 42 | 43 | 44 | 45 | org.wildfly.plugin.core 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/dev/WatchHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.dev; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | import java.nio.file.WatchEvent; 11 | 12 | import org.apache.maven.plugin.MojoExecutionException; 13 | 14 | /** 15 | * A handler for changes that happen to source files. 16 | * 17 | * @author James R. Perkins 18 | */ 19 | public interface WatchHandler { 20 | 21 | Result handle(WatchContext context, WatchEvent event, Path file) throws IOException, MojoExecutionException; 22 | 23 | /** 24 | * The result of handling the changed source file. 25 | */ 26 | interface Result { 27 | 28 | /** 29 | * Indicates whether a recompile is required. 30 | * 31 | * @return {@code true} if a recompile is required 32 | */ 33 | default boolean requiresRecompile() { 34 | return false; 35 | } 36 | 37 | /** 38 | * Indicates whether the deployment should be redeployed is required. 39 | * 40 | * @return {@code true} if the deployment should be redeployed is required 41 | */ 42 | default boolean requiresRedeploy() { 43 | return false; 44 | } 45 | 46 | /** 47 | * Indicates whether the resources should be copied. 48 | * 49 | * @return {@code true} if the resources should be copied 50 | */ 51 | default boolean requiresCopyResources() { 52 | return false; 53 | } 54 | 55 | /** 56 | * Indicates whether the deployment should be repackaged. 57 | * 58 | * @return {@code true} if the deployment should be repackaged 59 | */ 60 | default boolean requiresRepackage() { 61 | return false; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | test.war 28 | server-bootable.jar 29 | true 30 | packaged-bootable-server 31 | true 32 | true 33 | 34 | 35 | true 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = WildFly Application Server Maven Plugin 2 | 3 | A Maven plug-in for WildFly Application Server. This plugin allows you to: 4 | 5 | * Deploy, redeploy or undeploy your application 6 | * Add resources 7 | * Deploy and undeploy artifacts 8 | * Execute CLI commands 9 | * Run a standalone server within Maven 10 | * Galleon provisioning of a server. 11 | * Packaging of a fully configured server containing application deployment. 12 | * Packaging of a fully configured server and application as a Bootable JAR (an executable fat JAR). 13 | 14 | Plugin documentation is at https://docs.wildfly.org/wildfly-maven-plugin 15 | 16 | Issues can be filed at https://issues.redhat.com/browse/WFMP 17 | 18 | == License 19 | 20 | * link:LICENSE.txt[ASLv2] 21 | 22 | == Releasing 23 | 24 | Releasing this project requires access to https://repository.jboss.org/nexust[JBoss Nexus]. 25 | 26 | To perform a release ensure you're on the correct branch and that branch is up to date. Once done you can simply use 27 | the `release.sh` bash script. 28 | 29 | [source,bash] 30 | ---- 31 | ./release.sh -r 5.1.4.Final -d 5.1.5.Final-SNAPSHOT 32 | ---- 33 | 34 | If this was successful, instructions will be printed on the console with the next set of instructions for processing. 35 | 36 | [source,base] 37 | ---- 38 | ... 39 | [INFO] ------------------------------------------------------------------------ 40 | [INFO] BUILD SUCCESS 41 | [INFO] ------------------------------------------------------------------------ 42 | [INFO] Total time: 02:59 min 43 | [INFO] Finished at: 2025-09-04T13:32:25-07:00 44 | [INFO] ------------------------------------------------------------------------ 45 | 46 | Your release has been successful. Check the validation after 13:42:25 on https://repository.jboss.org/nexus. 47 | Once validation is successful, execute the following command: 48 | 49 | git checkout v5.1.4.Final 50 | mvn nxrm3:staging-move -Dmaven.repo.local="/tmp/m2/repository/wildfly-maven-plugin" 51 | git checkout main 52 | git push upstream main 53 | git push upstream v5.1.4.Final 54 | ---- -------------------------------------------------------------------------------- /.github/workflows/wildfly-build.yml: -------------------------------------------------------------------------------- 1 | # This workflow is for a nightly run against WildFly upstream 2 | 3 | name: WildFly Test Build 4 | 5 | on: 6 | push: 7 | branches: 8 | - 'main' 9 | paths: 10 | - '.github/workflows/wildfly-build.yml' 11 | - 'core/**' 12 | - 'plugin/**' 13 | - 'tests/**' 14 | - '**/pom.xml' 15 | pull_request: 16 | branches: 17 | - '**' 18 | paths: 19 | - '.github/workflows/wildfly-build.yml' 20 | - 'core/**' 21 | - 'plugin/**' 22 | - 'tests/**' 23 | - '**/pom.xml' 24 | schedule: 25 | - cron: '0 0 * * *' # Every day at 00:00 UTC 26 | 27 | # Only run the latest job and cancel previous ones 28 | concurrency: 29 | group: '${{ github.ref || github.run_id }}' 30 | cancel-in-progress: true 31 | 32 | jobs: 33 | 34 | wildfly-maven-plugin-build: 35 | runs-on: ${{ matrix.os }} 36 | strategy: 37 | fail-fast: false 38 | matrix: 39 | os: [ubuntu-latest, windows-latest] 40 | java: ['17', '21', '25'] 41 | 42 | steps: 43 | - uses: actions/checkout@v6 44 | - uses: wildfly-extras/wildfly-nightly-download@v1 45 | id: wildfly-nightly 46 | - name: Set up JDK ${{ matrix.java }} 47 | uses: actions/setup-java@v5 48 | with: 49 | java-version: ${{ matrix.java }} 50 | distribution: 'temurin' 51 | cache: 'maven' 52 | - name: Build with Maven Java ${{ matrix.java }} 53 | run: mvn clean install '-Dorg.jboss.logmanager.nocolor=true' '-Dversion.org.wildfly=${{steps.wildfly-nightly.outputs.wildfly-version}}' 54 | - name: Upload surefire reports 55 | uses: actions/upload-artifact@v6 56 | if: failure() 57 | with: 58 | name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} 59 | path: '**/surefire-reports/*' 60 | - name: Upload server logs 61 | uses: actions/upload-artifact@v6 62 | if: failure() 63 | with: 64 | name: server-logs-${{ matrix.os }}-${{ matrix.java }} 65 | path: '**/*.log' 66 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/image-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | image-server 28 | test.war 29 | wildfly-maven-plugin 30 | 31 | 1.0 32 | This text illustrates \ 33 | that label-values can span multiple lines. 34 | I have "quoted myself" here. 35 | 36 | 37 | 38 | true 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-no-deployment-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | false 23 | false 24 | 25 | 26 | standalone 27 | standalone.xml 28 | 29 | 30 | 31 | 32 | true 33 | packaged-no-dep-server 34 | 35 | 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/dev/WebAppResourceHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.dev; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | import java.nio.file.WatchEvent; 11 | import java.util.Collection; 12 | import java.util.HashSet; 13 | import java.util.Locale; 14 | import java.util.Set; 15 | import java.util.stream.Collectors; 16 | 17 | /** 18 | * @author James R. Perkins 19 | */ 20 | class WebAppResourceHandler implements WatchHandler { 21 | private static final Set NO_DEPLOYMENT_WEB_FILE_EXTENSIONS = Set.of( 22 | ".xhtml", 23 | ".html", 24 | ".jsp", 25 | ".js", 26 | ".css"); 27 | 28 | private final Set ignoredFileExtensions; 29 | 30 | WebAppResourceHandler(final Collection ignoredFileExtensions) { 31 | this.ignoredFileExtensions = ignoredFileExtensions.stream() 32 | .map((value) -> value.charAt(0) == '.' ? value : "." + value) 33 | .collect(Collectors.toCollection(HashSet::new)); 34 | this.ignoredFileExtensions.addAll(NO_DEPLOYMENT_WEB_FILE_EXTENSIONS); 35 | } 36 | 37 | @Override 38 | public Result handle(final WatchContext context, final WatchEvent event, final Path file) throws IOException { 39 | // Check the file extension to see if a redeploy should be ignored 40 | final String fileName = file.getFileName().toString(); 41 | final int dot = fileName.lastIndexOf('.'); 42 | final boolean requiresRedeploy = dot <= 0 || 43 | !ignoredFileExtensions.contains(fileName.substring(dot).toLowerCase(Locale.ROOT)); 44 | return new Result() { 45 | 46 | @Override 47 | public boolean requiresRepackage() { 48 | return true; 49 | } 50 | 51 | @Override 52 | public boolean requiresRedeploy() { 53 | return requiresRedeploy; 54 | } 55 | }; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /plugin/src/site/fml/faq.fml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 15 | What versions of maven will the plugin work with? 16 | 17 |

The plugin requires maven 3.3.1 or higher.

18 |
19 |
20 | 21 | Why are archived server downloads being deprecated? 22 | 23 |

24 | In 3.0.0 new goals will be introduced to allow provisioning a server. WildFly Galleon has come a long 25 | way and it is the preferred means of creating a server. For this reason, the downloading of a server 26 | by means of a Maven artifact will be removed in 3.0.0. 27 |

28 |
29 |
30 | 31 | Why is my server reloading after I execute CLI commands? 32 | 33 |

34 | In 4.2.1 a new configuration parameter, auto-reload, was added which automatically 35 | reloads the running server if offline is set to false and the command 36 | left the server in a state of reload-required. If you previously had a reload operation 37 | or command in your script or command list, you can now remove it. The other option would be to set 38 | the auto-reload configuration to false. 39 |

40 |
41 |
42 |
43 |
44 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/DeployOnlyMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.net.URL; 9 | 10 | import org.apache.maven.plugins.annotations.Execute; 11 | import org.apache.maven.plugins.annotations.LifecyclePhase; 12 | import org.apache.maven.plugins.annotations.Mojo; 13 | import org.apache.maven.plugins.annotations.Parameter; 14 | import org.wildfly.plugin.common.PropertyNames; 15 | import org.wildfly.plugin.tools.Deployment; 16 | 17 | /** 18 | * Deploys only the application to the WildFly Application Server without first invoking the 19 | * the execution of the lifecycle phase 'package' prior to executing itself. 20 | *

21 | * If {@code force} is set to {@code true}, the server is queried to see if the application already exists. If the 22 | * application already exists, the application is redeployed instead of deployed. If the application does not exist the 23 | * application is deployed as normal. 24 | *

25 | * If {@code force} is set to {@code false} and the application has already been deployed to the server, an error 26 | * will occur and the deployment will fail. 27 | */ 28 | @Mojo(name = "deploy-only", threadSafe = true) 29 | @Execute(phase = LifecyclePhase.NONE) 30 | public class DeployOnlyMojo extends DeployMojo { 31 | 32 | /** 33 | * A URL representing the a path to the content to be deployed. The server the content is being deployed to will 34 | * require access to the URL. 35 | *

36 | * If defined this overrides the {@code filename} and {@code targetDir} configuration parameters. 37 | *

38 | */ 39 | @Parameter(alias = "content-url", property = PropertyNames.DEPLOYMENT_CONTENT_URL) 40 | private URL contentUrl; 41 | 42 | @Override 43 | public String goal() { 44 | return "deploy-only"; 45 | } 46 | 47 | @Override 48 | protected Deployment createDeployment() { 49 | if (contentUrl == null) { 50 | return super.createDeployment(); 51 | } 52 | return Deployment.of(contentUrl); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /.github/workflows/nightly-ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: WildFly Maven Plugin - Nightly CI 5 | 6 | on: 7 | push: 8 | branches-ignore: 9 | - 'dependabot/**' 10 | paths: 11 | - '.github/workflows/nightly-ci.yml' 12 | pull_request: 13 | paths: 14 | - '.github/workflows/nightly-ci.yml' 15 | 16 | schedule: 17 | - cron: '0 2 * * *' # Every day at 03:00 UTC 18 | 19 | # Only run the latest job 20 | concurrency: 21 | group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' 22 | cancel-in-progress: true 23 | 24 | 25 | jobs: 26 | nightly-build-test: 27 | name: ${{ matrix.os }}-jdk${{ matrix.java }} 28 | runs-on: ${{ matrix.os }} 29 | strategy: 30 | fail-fast: false 31 | matrix: 32 | os: [ubuntu-latest, windows-latest ] 33 | java: ['17', '21', '25'] 34 | 35 | steps: 36 | - uses: actions/checkout@v6 37 | - name: Set up JDK ${{ matrix.java }} 38 | uses: actions/setup-java@v5 39 | with: 40 | java-version: ${{ matrix.java }} 41 | cache: 'maven' 42 | distribution: 'temurin' 43 | - name: Build and Test on ${{ matrix.java }} - ${{ matrix.wildfly-version }} 44 | run: mvn clean install '-Dorg.jboss.logmanager.nocolor=true' 45 | - name: Upload surefire logs for failed run 46 | uses: actions/upload-artifact@v6 47 | if: failure() 48 | with: 49 | name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} 50 | path: '**/surefire-reports/' 51 | - name: Upload failsafe logs for failed run 52 | uses: actions/upload-artifact@v6 53 | if: failure() 54 | with: 55 | name: failsafe-reports-${{ matrix.os }}-${{ matrix.java }} 56 | path: '**/failsafe-reports/' 57 | - name: Upload logs for failed run 58 | uses: actions/upload-artifact@v6 59 | if: failure() 60 | with: 61 | name: server-logs-${{ matrix.os }}-${{ matrix.java }} 62 | path: '**/*.log' -------------------------------------------------------------------------------- /tests/shared/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | org.wildfly.plugins 10 | wildfly-maven-plugin-tests 11 | 6.0.0.Beta1-SNAPSHOT 12 | 13 | 4.0.0 14 | 15 | wildfly-maven-plugin-tests-shared 16 | 17 | 18 | 19 | ${project.build.testOutputDirectory}${file.separator}test-project 20 | 21 | 22 | 23 | 24 | 25 | org.jboss.galleon 26 | galleon-core 27 | 28 | 29 | ${project.groupId} 30 | wildfly-maven-plugin 31 | ${project.version} 32 | 33 | 34 | ${project.groupId} 35 | wildfly-plugin-core 36 | ${project.version} 37 | 38 | 39 | junit 40 | junit 41 | 42 | 43 | org.apache.maven 44 | maven-compat 45 | 46 | 47 | org.apache.maven 48 | maven-settings-builder 49 | 50 | 51 | org.apache.maven.plugin-testing 52 | maven-plugin-testing-harness 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /tests/domain-tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 4.0.0 9 | 10 | org.wildfly.plugins 11 | wildfly-maven-plugin-tests 12 | 6.0.0.Beta1-SNAPSHOT 13 | 14 | 15 | wildfly-maven-plugin-domain-tests 16 | WildFly Maven Plugin - Domain Tests 17 | 18 | Tests the maven plugin goals with a domain server 19 | 20 | 21 | 22 | ${project.build.testOutputDirectory}${file.separator}test-project 23 | 24 | 25 | 26 | 27 | 28 | ${project.groupId} 29 | wildfly-maven-plugin-tests-shared 30 | ${project.version} 31 | test 32 | 33 | 34 | junit 35 | junit 36 | test 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-install-plugin 45 | 46 | true 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-deploy-plugin 52 | 53 | true 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/cli/OfflineCommandExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.cli; 7 | 8 | import java.io.IOException; 9 | import java.nio.file.Path; 10 | 11 | import javax.inject.Named; 12 | import javax.inject.Singleton; 13 | 14 | import org.apache.maven.plugin.MojoExecutionException; 15 | import org.apache.maven.plugin.MojoFailureException; 16 | import org.jboss.galleon.universe.maven.repo.MavenRepoManager; 17 | import org.wildfly.core.launcher.CliCommandBuilder; 18 | import org.wildfly.plugin.common.StandardOutput; 19 | import org.wildfly.plugin.tools.server.ServerManager; 20 | 21 | /** 22 | * A command executor for executing offline CLI commands. 23 | * 24 | * @author jdenise@redhat.com 25 | */ 26 | @Singleton 27 | @Named 28 | public class OfflineCommandExecutor extends AbstractCommandExecutor { 29 | 30 | /** 31 | * Executes forked offline CLI commands based on the configuration. 32 | * 33 | * @param config the configuration used to execute the CLI commands 34 | * @param artifactResolver Resolver to retrieve CLI artifact for in-process execution. 35 | * 36 | * @throws MojoFailureException if the JBoss Home directory is required and invalid 37 | * @throws MojoExecutionException if an error occurs executing the CLI commands 38 | */ 39 | @Override 40 | public void execute(final BaseCommandConfiguration config, MavenRepoManager artifactResolver) 41 | throws MojoFailureException, MojoExecutionException { 42 | if (!ServerManager.isValidHomeDirectory(config.getJBossHome())) { 43 | throw new MojoFailureException("Invalid JBoss Home directory is not valid: " + config.getJBossHome()); 44 | } 45 | executeInNewProcess(config); 46 | } 47 | 48 | @Override 49 | protected int executeInNewProcess(final BaseCommandConfiguration config, final Path scriptFile, final StandardOutput stdout) 50 | throws MojoExecutionException, IOException { 51 | CliCommandBuilder builder = createCommandBuilder(config, scriptFile); 52 | return launchProcess(builder, config, stdout); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/execute-commands-fork-continueOnError-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | true 20 | false 21 | 22 | /system-property=propertyContinueOnError:add(value="initial value") 23 | /system-property=propertyContinueOnError:add(value="second value") 24 | /system-property=propertyContinueOnError:write-attribute(name=value, value="continue on error") 25 | module remove --name=org.wildfly.plugin.tests 26 | module add --name=org.wildfly.plugin.tests --dependencies=org.jboss.logging --resources=${project.build.directory}${file.separator}test.jar 27 | try 28 | /system-property=propertyContinueOnError.in.try:add(value="initial value") 29 | /system-property=propertyContinueOnError.in.try:add(value="second value") 30 | catch 31 | /system-property=propertyContinueOnError.in.try:write-attribute(name=value, value="inside catch") 32 | end-try 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/domain-tests/src/test/java/org/wildfly/plugin/deployment/resources/AddResourceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment.resources; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | import java.util.Collections; 11 | 12 | import org.junit.Test; 13 | import org.wildfly.plugin.deployment.resource.AddResourceMojo; 14 | import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest; 15 | 16 | /** 17 | * AddResource test case 18 | * 19 | * @author Dave Heath 20 | */ 21 | // @Ignore("Composite operations don't seem to be working with datasources") 22 | public class AddResourceTest extends AbstractWildFlyServerMojoTest { 23 | 24 | @Test 25 | public void testCanAddCompositeResource() throws Exception { 26 | 27 | final AddResourceMojo addResourceMojo = find("add-resource-with-composite-pom.xml"); 28 | try { 29 | addResourceMojo.execute(); 30 | } catch (Exception ex) { 31 | fail(ex.getMessage()); 32 | } 33 | 34 | } 35 | 36 | @Test 37 | public void testCanAddResource() throws Exception { 38 | 39 | AddResourceMojo addResourceMojo = find("add-resource-pom.xml"); 40 | try { 41 | addResourceMojo.execute(); 42 | } catch (Exception ex) { 43 | fail(ex.getMessage()); 44 | } 45 | 46 | } 47 | 48 | @Test 49 | public void testCanAddXaDataSource() throws Exception { 50 | 51 | final AddResourceMojo addResourceMojo = find("add-resource-xa-datasource.xml"); 52 | try { 53 | addResourceMojo.execute(); 54 | } catch (Exception ex) { 55 | fail(ex.getMessage()); 56 | } 57 | 58 | } 59 | 60 | private AddResourceMojo find(final String pom) throws Exception { 61 | final AddResourceMojo addResourceMojo = lookupMojoAndVerify("add-resource", pom); 62 | // Profiles are required to be set and when there is a property defined on an attribute parameter the test 63 | // harness does not set the fields 64 | setValue(addResourceMojo, "profiles", Collections.singletonList("full")); 65 | return addResourceMojo; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-grpc-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | org.wildfly.extras.grpc:wildfly-grpc-feature-pack:GRPC_VERSION 25 | 26 | 27 | 28 | jaxrs-server 29 | grpc 30 | 31 | test.war 32 | server-bootable.jar 33 | true 34 | packaged-bootable-server 35 | true 36 | true 37 | preview 38 | 39 | 40 | true 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-multiple-deployments-missing-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | org.foo 15 | bar 16 | 1.0 17 | jar 18 | system 19 | ${basedir}/dummy.jar 20 | 21 | 22 | 23 | 24 | 25 | 26 | org.wildfly.plugins 27 | wildfly-maven-plugin 28 | 29 | test.war 30 | true 31 | packaged-multiple-deployments-missing-server 32 | 33 | org.foo:bar:war 34 | 35 | 36 | 37 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 38 | 39 | 40 | 41 | jaxrs-server 42 | 43 | 44 | 45 | true 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/DeployMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.io.IOException; 9 | 10 | import org.apache.maven.plugins.annotations.Execute; 11 | import org.apache.maven.plugins.annotations.LifecyclePhase; 12 | import org.apache.maven.plugins.annotations.Mojo; 13 | import org.apache.maven.plugins.annotations.Parameter; 14 | import org.apache.maven.plugins.annotations.ResolutionScope; 15 | import org.wildfly.plugin.common.PropertyNames; 16 | import org.wildfly.plugin.tools.Deployment; 17 | import org.wildfly.plugin.tools.DeploymentManager; 18 | import org.wildfly.plugin.tools.DeploymentResult; 19 | 20 | /** 21 | * Deploys the application to the WildFly Application Server. 22 | *

23 | * If {@code force} is set to {@code true}, the server is queried to see if the application already exists. If the 24 | * application already exists, the application is redeployed instead of deployed. If the application does not exist the 25 | * application is deployed as normal. 26 | *

27 | * If {@code force} is set to {@code false} and the application has already been deployed to the server, an error 28 | * will occur and the deployment will fail. 29 | * 30 | * @author James R. Perkins 31 | */ 32 | @Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true) 33 | @Execute(phase = LifecyclePhase.PACKAGE) 34 | public class DeployMojo extends AbstractAppDeployment { 35 | 36 | /** 37 | * Specifies whether force mode should be used or not. 38 | *

39 | * If force mode is disabled, the deploy goal will cause a build failure if the application being deployed already 40 | * exists. 41 | */ 42 | @Parameter(defaultValue = "true", property = PropertyNames.DEPLOY_FORCE) 43 | private boolean force; 44 | 45 | @Override 46 | public String goal() { 47 | return "deploy"; 48 | } 49 | 50 | @Override 51 | protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment) 52 | throws IOException { 53 | if (force) { 54 | return deploymentManager.forceDeploy(deployment); 55 | } 56 | return deploymentManager.deploy(deployment); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/deployment/UndeploymentMatchTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | 10 | import java.util.Set; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.junit.After; 15 | import org.junit.Before; 16 | import org.junit.Test; 17 | import org.wildfly.plugin.tests.AbstractWildFlyServerMojoTest; 18 | import org.wildfly.plugin.tools.DeploymentDescription; 19 | import org.wildfly.plugin.tools.DeploymentManager; 20 | 21 | /** 22 | * Matcher Undeployment test case. 23 | * 24 | * @author Mark Paluch 25 | */ 26 | public class UndeploymentMatchTest extends AbstractWildFlyServerMojoTest { 27 | 28 | @Inject 29 | private DeploymentManager deploymentManager; 30 | 31 | @Before 32 | public void before() throws Exception { 33 | 34 | deploymentManager.deploy(getDeployment().setName("test-undeploy-1.war")); 35 | deploymentManager.deploy(getDeployment().setName("test-undeploy-2.war")); 36 | } 37 | 38 | @Test 39 | public void undeployAll() throws Exception { 40 | 41 | undeploy(MatchPatternStrategy.ALL); 42 | 43 | final Set deployments = deploymentManager.getDeployments(); 44 | assertEquals(0, deployments.size()); 45 | } 46 | 47 | @Test 48 | public void undeployFirst() throws Exception { 49 | 50 | undeploy(MatchPatternStrategy.FIRST); 51 | 52 | final Set deployments = deploymentManager.getDeployments(); 53 | assertEquals(1, deployments.size()); 54 | } 55 | 56 | @Test(expected = MojoDeploymentException.class) 57 | public void undeployFail() throws Exception { 58 | undeploy(MatchPatternStrategy.FAIL); 59 | } 60 | 61 | @After 62 | public void after() throws Exception { 63 | undeploy(MatchPatternStrategy.ALL); 64 | } 65 | 66 | private void undeploy(MatchPatternStrategy matchPatternStrategy) throws Exception { 67 | 68 | final UndeployMojo undeployMojo = lookupMojoAndVerify("undeploy", "undeploy-webarchive-match-pom.xml"); 69 | 70 | setValue(undeployMojo, "matchPatternStrategy", matchPatternStrategy.toString()); 71 | undeployMojo.execute(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /tests/shared/src/main/java/org/wildfly/plugin/tests/AbstractWildFlyServerMojoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.tests; 7 | 8 | import static org.junit.Assert.fail; 9 | 10 | import java.io.IOException; 11 | import java.nio.file.FileVisitResult; 12 | import java.nio.file.Files; 13 | import java.nio.file.Path; 14 | import java.nio.file.SimpleFileVisitor; 15 | import java.nio.file.attribute.BasicFileAttributes; 16 | 17 | import javax.inject.Inject; 18 | 19 | import org.jboss.as.controller.client.ModelControllerClient; 20 | import org.jboss.as.controller.client.helpers.Operations; 21 | import org.jboss.dmr.ModelNode; 22 | import org.junit.runner.RunWith; 23 | import org.wildfly.plugin.tests.runner.WildFlyTestRunner; 24 | 25 | /** 26 | * @author James R. Perkins 27 | */ 28 | @RunWith(WildFlyTestRunner.class) 29 | public abstract class AbstractWildFlyServerMojoTest extends AbstractWildFlyMojoTest { 30 | 31 | @Inject 32 | protected ModelControllerClient client; 33 | 34 | protected ModelNode executeOperation(final ModelNode op) throws IOException { 35 | final ModelNode result = client.execute(op); 36 | if (!Operations.isSuccessfulOutcome(result)) { 37 | fail(Operations.getFailureDescription(result).asString()); 38 | } 39 | return result; 40 | } 41 | 42 | protected static void deleteRecursively(final Path path) throws IOException { 43 | if (Files.exists(path)) { 44 | if (Files.isDirectory(path)) { 45 | Files.walkFileTree(path, new SimpleFileVisitor() { 46 | @Override 47 | public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { 48 | Files.deleteIfExists(file); 49 | return FileVisitResult.CONTINUE; 50 | } 51 | 52 | @Override 53 | public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException { 54 | Files.deleteIfExists(dir); 55 | return FileVisitResult.CONTINUE; 56 | } 57 | }); 58 | } else { 59 | Files.deleteIfExists(path); 60 | } 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/add-resource-xa-datasource.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 |
subsystem=datasources
20 | 21 | 22 |
xa-data-source=java:/xa-ds-name
23 | 24 | java:jboss/xa-ds-name 25 | true 26 | org.h2.jdbcx.JdbcDataSource 27 | h2 28 | xa-pool 29 | sa 30 | sa 31 | false 32 | false 33 | 34 | 35 | 36 |
xa-datasource-properties=URL
37 | 38 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 39 | 40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 49 |
-------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 |
subsystem=datasources
20 | 21 | 22 |
data-source=java:/ds-name2
23 | 24 | java:jboss/ds-name2 25 | true 26 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 27 | org.h2.Driver 28 | h2 29 | sa 30 | sa 31 | 32 |
33 | 34 | 35 |
data-source=java:/ds-name3
36 | 37 | java:jboss/ds-name3 38 | true 39 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 40 | org.h2.Driver 41 | h2 42 | sa 43 | sa 44 | 45 |
46 |
47 |
48 |
49 |
50 |
51 | 52 |
-------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/add-resource-xa-datasource.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | full 21 | 22 |
subsystem=datasources
23 | 24 | 25 |
xa-data-source=java:/xa-ds-name
26 | 27 | java:jboss/xa-ds-name 28 | true 29 | org.h2.jdbcx.JdbcDataSource 30 | h2 31 | xa-pool 32 | sa 33 | sa 34 | false 35 | false 36 | 37 | 38 | 39 |
xa-datasource-properties=URL
40 | 41 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 42 | 43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 52 |
-------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-channel-glow-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | 22 | 23 | WF_BASE_DIR_ABSOLUTE_URL/wildfly-32.0.0.Final-manifest.yaml 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 35 | 36 | 37 | 38 | test.war 39 | 40 | extra-content 41 | 42 | true 43 | packaged-channel-glow-server 44 | 45 | 46 | true 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/bootable-tests/src/test/resources/test-project/package-bootable-config-name-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | false 23 | false 24 | 25 | 26 | standalone-ha.xml 27 | standalone 28 | 29 | 30 | 31 | 32 | 33 | microprofile-config 34 | 35 | test.war 36 | standalone-ha.xml 37 | server-bootable.jar 38 | true 39 | packaged-bootable-server-config-name 40 | true 41 | true 42 | 43 | 44 | true 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | 28 | deployment-scanner 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 37 | 38 | 39 | 40 | test.war 41 | 42 | extra-content 43 | 44 | true 45 | packaged-server 46 | 47 | 48 | true 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/AbstractAppDeployment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.io.File; 9 | 10 | import org.apache.maven.plugins.annotations.Parameter; 11 | import org.wildfly.plugin.common.PropertyNames; 12 | 13 | /** 14 | * @author James R. Perkins 15 | */ 16 | abstract class AbstractAppDeployment extends AbstractDeployment { 17 | 18 | /** 19 | * The target directory the application to be deployed is located. 20 | */ 21 | @Parameter(defaultValue = "${project.build.directory}/", property = PropertyNames.DEPLOYMENT_TARGET_DIR) 22 | private File targetDir; 23 | 24 | /** 25 | * The file name of the application to be deployed. 26 | *

27 | * The {@code filename} property does have a default of ${project.build.finalName}.${project.packaging}. 28 | * The default value is not injected as it normally would be due to packaging types like {@code ejb} that result in 29 | * a file with a {@code .jar} extension rather than an {@code .ejb} extension. 30 | *

31 | */ 32 | @Parameter(property = PropertyNames.DEPLOYMENT_FILENAME) 33 | private String filename; 34 | 35 | /** 36 | * By default certain package types are ignored when processing, e.g. {@code maven-project} and {@code pom}. Set 37 | * this value to {@code false} if this check should be bypassed. 38 | */ 39 | @Parameter(alias = "check-packaging", property = PropertyNames.CHECK_PACKAGING, defaultValue = "true") 40 | private boolean checkPackaging; 41 | 42 | @Override 43 | protected boolean skipExecution() { 44 | boolean skip = super.skipExecution(); 45 | if (!skip) { 46 | final PackageType packageType = PackageType.resolve(project); 47 | if (checkPackaging && packageType.isIgnored()) { 48 | getLog().debug(String.format("Ignoring packaging type %s.", packageType.getPackaging())); 49 | skip = true; 50 | } 51 | } 52 | return skip; 53 | } 54 | 55 | @Override 56 | protected File file() { 57 | final PackageType packageType = PackageType.resolve(project); 58 | final String filename; 59 | if (this.filename == null) { 60 | filename = String.format("%s.%s", project.getBuild().getFinalName(), packageType.getFileExtension()); 61 | } else { 62 | filename = this.filename; 63 | } 64 | return new File(targetDir, filename); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /plugin/src/site/markdown/channel-example.md.vm: -------------------------------------------------------------------------------- 1 | # Using Channels 2 | 3 | Channels can be used to provision a ${appServerName} server in goals that allow channels for provisioning. A 4 | [WildFly Channel](https://github.com/wildfly-extras/wildfly-channel/blob/main/doc/spec.adoc) is a YAML file of Maven 5 | GAV's. Channels can be used to provision the latest version of ${appServerName} and/or other components that generate a 6 | channel manifests. 7 | 8 | #[[##]]# Provision the Latest Release 9 | 10 | The example below shows how to provision the latest version of ${appServerName}. 11 | 12 | ```xml 13 | 14 | ${project.groupId} 15 | ${project.artifactId} 16 | ${project.version} 17 | 18 | 19 | 20 | org.wildfly 21 | wildfly-ee-galleon-pack 22 | 23 | 24 | 25 | 26 | 27 | org.wildfly.channels 28 | wildfly-ee 29 | 30 | 31 | 32 | 33 | 34 | ``` 35 | 36 | #[[##]]# Provision Additional Channels 37 | 38 | The example below will provision a specific version of ${appServerName} with the latest version of RESTEasy on the 39 | latest ${resteasyChannelStream}. 40 | 41 | ```xml 42 | 43 | ${project.groupId} 44 | ${project.artifactId} 45 | ${project.version} 46 | 47 | 48 | 49 | org.wildfly 50 | wildfly-ee-galleon-pack 51 | 52 | 53 | 54 | 55 | 56 | org.wildfly.channels 57 | wildfly-ee 58 | ${wildflyVersion} 59 | 60 | 61 | 62 | 63 | dev.resteasy.channels 64 | resteasy-${resteasyChannelStream} 65 | 66 | 67 | 68 | 69 | 70 | ``` -------------------------------------------------------------------------------- /tests/domain-tests/src/test/resources/test-project/add-resource-with-composite-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | full 21 | 22 |
subsystem=datasources
23 | 24 | 25 |
data-source=java:/ds-name2
26 | 27 | java:jboss/ds-name2 28 | true 29 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 30 | org.h2.Driver 31 | h2 32 | sa 33 | sa 34 | 35 |
36 | 37 | 38 |
data-source=java:/ds-name3
39 | 40 | java:jboss/ds-name3 41 | true 42 | jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 43 | org.h2.Driver 44 | h2 45 | sa 46 | sa 47 | 48 |
49 |
50 |
51 |
52 |
53 |
54 | 55 |
-------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/resource/Resource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment.resource; 7 | 8 | import java.util.Collections; 9 | import java.util.Map; 10 | 11 | import org.apache.maven.plugins.annotations.Parameter; 12 | 13 | /** 14 | * Defines a resource. 15 | * 16 | * @author James R. Perkins 17 | */ 18 | public class Resource { 19 | 20 | /** 21 | * The operation address. 22 | */ 23 | @Parameter 24 | private String address; 25 | 26 | /** 27 | * Only adds the resource if the resource does not already exist. If the resource already exists, the resource is 28 | * skipped. 29 | */ 30 | @Parameter 31 | private boolean addIfAbsent; 32 | 33 | /** 34 | * The operation properties for the resource. 35 | */ 36 | @Parameter 37 | private Map properties; 38 | 39 | /** 40 | * An array of resources that rely on this resource. 41 | *

42 | * Note all resources will be ignored if the {@code } is defined and his resource is already defined. 43 | */ 44 | @Parameter 45 | private Resource[] resources; 46 | 47 | /** 48 | * Default constructor. 49 | */ 50 | public Resource() { 51 | 52 | } 53 | 54 | /** 55 | * The address for the resource. 56 | * 57 | * @return the address. 58 | */ 59 | public String getAddress() { 60 | return address; 61 | } 62 | 63 | /** 64 | * Whether or not we should add only if the resource is absent. 65 | * 66 | * @return {@code true} if the resource should only be added if it does not already exist, otherwise {@code false}. 67 | */ 68 | public boolean isAddIfAbsent() { 69 | return addIfAbsent; 70 | } 71 | 72 | /** 73 | * The properties for the resource. If no properties were defined an empty map is returned. 74 | * 75 | * @return the properties. 76 | */ 77 | public Map getProperties() { 78 | if (properties == null) { 79 | return Collections.emptyMap(); 80 | } 81 | return properties; 82 | } 83 | 84 | /** 85 | * Returns an array of resources that depend on this resource. 86 | *

87 | * Note all sub-resources will be ignored if the {@link #isAddIfAbsent()} is defined and his resource is already 88 | * defined. 89 | * 90 | * @return an array of resources that depend on this resource or {@code null} if there are no child resources. 91 | */ 92 | public Resource[] getResources() { 93 | return resources; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | 28 | deployment-scanner 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 37 | 38 | 39 | 40 | test-foo.war 41 | 42 |

extra-content 43 | 44 | true 45 | packaged-invalid-dep-server 46 | true 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-grpc-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 22 | 23 | 24 | org.wildfly.extras.grpc:wildfly-grpc-feature-pack:GRPC_VERSION 25 | 26 | 27 | 28 | jaxrs-server 29 | grpc 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 38 | 39 | 40 | 41 | test.war 42 | 43 | extra-content 44 | 45 | preview 46 | true 47 | packaged-grpc-server 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-invalid-deployment2-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | foo 15 | 16 | 17 | org.wildfly.plugins 18 | wildfly-maven-plugin 19 | 20 | 21 | 22 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 23 | 24 | 25 | 26 | jaxrs-server 27 | 28 | 29 | deployment-scanner 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 38 | 39 | 40 | 41 | test-foo.war 42 | 43 | extra-content 44 | 45 | true 46 | packaged-invalid-dep2-server 47 | true 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: WildFly Maven Plugin - CI 5 | 6 | on: 7 | push: 8 | branches-ignore: 9 | - 'dependabot/**' 10 | paths: 11 | - '.github/workflows/ci.yml' 12 | - 'core/**' 13 | - 'plugin/**' 14 | - 'tests/**' 15 | - '**/pom.xml' 16 | pull_request: 17 | paths: 18 | - '.github/workflows/ci.yml' 19 | - 'core/**' 20 | - 'plugin/**' 21 | - 'tests/**' 22 | - '**/pom.xml' 23 | 24 | # Only run the latest job 25 | concurrency: 26 | group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' 27 | cancel-in-progress: true 28 | 29 | 30 | jobs: 31 | 32 | format-check: 33 | runs-on: ubuntu-latest 34 | timeout-minutes: 30 35 | 36 | steps: 37 | - uses: actions/checkout@v6 38 | - name: Set up JDK 21 39 | uses: actions/setup-java@v5 40 | with: 41 | java-version: 21 42 | distribution: 'temurin' 43 | cache: 'maven' 44 | - name: Validate Formatting 45 | run: | 46 | mvn -B validate -Pformat-check -Denforcer.skip=true 47 | 48 | build: 49 | name: ${{ matrix.os }}-jdk${{ matrix.java }}-${{ matrix.wildfly-version }} 50 | needs: format-check 51 | runs-on: ${{ matrix.os }} 52 | strategy: 53 | fail-fast: false 54 | matrix: 55 | os: [ubuntu-latest, windows-latest ] 56 | java: ['17', '21', '25'] 57 | 58 | steps: 59 | - uses: actions/checkout@v6 60 | - name: Set up JDK ${{ matrix.java }} 61 | uses: actions/setup-java@v5 62 | with: 63 | java-version: ${{ matrix.java }} 64 | cache: 'maven' 65 | distribution: 'temurin' 66 | - name: Build and Test on ${{ matrix.java }} - ${{ matrix.wildfly-version }} 67 | run: mvn clean install '-Dorg.jboss.logmanager.nocolor=true' 68 | - name: Upload surefire logs for failed run 69 | uses: actions/upload-artifact@v6 70 | if: failure() 71 | with: 72 | name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} 73 | path: '**/surefire-reports/' 74 | - name: Upload failsafe logs for failed run 75 | uses: actions/upload-artifact@v6 76 | if: failure() 77 | with: 78 | name: failsafe-reports-${{ matrix.os }}-${{ matrix.java }} 79 | path: '**/failsafe-reports/' 80 | - name: Upload logs for failed run 81 | uses: actions/upload-artifact@v6 82 | if: failure() 83 | with: 84 | name: server-logs-${{ matrix.os }}-${{ matrix.java }} 85 | path: '**/*.log' -------------------------------------------------------------------------------- /core/src/main/java/org/wildfly/plugin/core/MavenProxySelector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.core; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.regex.Pattern; 10 | 11 | import org.eclipse.aether.repository.Proxy; 12 | import org.eclipse.aether.util.repository.AuthenticationBuilder; 13 | 14 | /** 15 | * 16 | * @author jdenise 17 | */ 18 | class MavenProxySelector { 19 | 20 | static class Builder { 21 | 22 | private String userName; 23 | private String password; 24 | private final String host; 25 | private final int port; 26 | private final String protocol; 27 | private final List nonProxyHosts = new ArrayList<>(); 28 | 29 | Builder(String host, int port, String protocol) { 30 | this.host = host; 31 | this.port = port; 32 | this.protocol = protocol; 33 | } 34 | 35 | Builder setUserName(String userName) { 36 | this.userName = userName; 37 | return this; 38 | } 39 | 40 | Builder setPassword(String password) { 41 | this.password = password; 42 | return this; 43 | } 44 | 45 | Builder addNonProxyHosts(List lst) { 46 | for (String h : lst) { 47 | h = h.replaceAll("\\*", ".*"); 48 | nonProxyHosts.add(Pattern.compile(h)); 49 | } 50 | return this; 51 | } 52 | 53 | MavenProxySelector build() { 54 | return new MavenProxySelector(host, port, protocol, userName, 55 | password, nonProxyHosts); 56 | } 57 | } 58 | 59 | private final List nonProxyHosts; 60 | private final Proxy proxy; 61 | 62 | MavenProxySelector(String host, int port, String protocol, String userName, 63 | String password, List nonProxyHosts) { 64 | this.nonProxyHosts = nonProxyHosts; 65 | if (userName != null && password != null) { 66 | AuthenticationBuilder builder = new AuthenticationBuilder(); 67 | builder.addPassword(password); 68 | builder.addUsername(userName); 69 | proxy = new Proxy(protocol, host, port, builder.build()); 70 | } else { 71 | proxy = new Proxy(protocol, host, port); 72 | } 73 | } 74 | 75 | public Proxy getProxy(String host) { 76 | return proxyFor(host) ? proxy : null; 77 | } 78 | 79 | private boolean proxyFor(String host) { 80 | boolean match = false; 81 | for (Pattern p : nonProxyHosts) { 82 | if (p.matcher(host).matches()) { 83 | match = true; 84 | break; 85 | } 86 | } 87 | return !match; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-no-multiple-deployments-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | testing 15 | dummy 16 | 1.0 17 | system 18 | ${basedir}/dummy.jar 19 | 20 | 21 | testing 22 | dummy-test 23 | 1.0 24 | system 25 | ${basedir}/dummy-test.jar 26 | 27 | 28 | testing 29 | dummy-test-common 30 | 1.0 31 | system 32 | ${basedir}/dummy-test-common.jar 33 | 34 | 35 | org.junit.jupiter 36 | junit-jupiter 37 | 5.11.3 38 | test 39 | 40 | 41 | 42 | 43 | 44 | org.wildfly.plugins 45 | wildfly-maven-plugin 46 | 47 | test.war 48 | true 49 | packaged-no-multiple-deployments-server 50 | 51 | 52 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 53 | 54 | 55 | 56 | jaxrs-server 57 | 58 | 59 | 60 | true 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/cli/ScriptWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.cli; 7 | 8 | import java.io.BufferedWriter; 9 | import java.io.IOException; 10 | import java.nio.charset.StandardCharsets; 11 | import java.nio.file.Files; 12 | import java.nio.file.Path; 13 | 14 | /** 15 | * @author James R. Perkins 16 | */ 17 | class ScriptWriter { 18 | 19 | /** 20 | * Creates a script file for the commands. If {@code failOnError} is {@code false} the command will be wrapped in a 21 | * {@code try-catch} command. 22 | * 23 | * @param config the command configuration being used 24 | * 25 | * @return the script file 26 | * 27 | * @throws IOException if an error occurs creating the script file 28 | */ 29 | static Path create(final BaseCommandConfiguration config) throws IOException { 30 | final Path tempScript = Files.createTempFile("cli-scrpts", ".cli"); 31 | try (BufferedWriter writer = Files.newBufferedWriter(tempScript, StandardCharsets.UTF_8)) { 32 | if (config.isBatch()) { 33 | writer.write("batch"); 34 | writer.newLine(); 35 | } 36 | 37 | boolean inTry = false; 38 | 39 | for (String cmd : config.getCommands()) { 40 | if (cmd == null || cmd.isEmpty()) { 41 | continue; 42 | } 43 | if (config.isFailOnError()) { 44 | writeCommand(writer, cmd); 45 | } else { 46 | if ("try".equals(cmd.trim())) { 47 | inTry = true; 48 | } 49 | if (inTry) { 50 | writeCommand(writer, cmd); 51 | } else { 52 | writeCommandInTry(writer, cmd); 53 | } 54 | if ("end-try".equals(cmd.trim())) { 55 | inTry = false; 56 | } 57 | } 58 | } 59 | 60 | if (config.isBatch()) { 61 | writer.write("run-batch"); 62 | writer.newLine(); 63 | } 64 | } 65 | return tempScript; 66 | } 67 | 68 | private static void writeCommand(final BufferedWriter writer, final String cmd) throws IOException { 69 | writer.write(cmd); 70 | writer.newLine(); 71 | } 72 | 73 | private static void writeCommandInTry(final BufferedWriter writer, final String cmd) throws IOException { 74 | writer.write("try"); 75 | writer.newLine(); 76 | writeCommand(writer, cmd); 77 | writer.write("catch"); 78 | writer.newLine(); 79 | writer.write("echo Failed to execute command: \""); 80 | writer.write(cmd); 81 | writer.write('"'); 82 | writer.newLine(); 83 | writer.write("end-try"); 84 | writer.newLine(); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-channel-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | 15 | 16 | org.wildfly.plugins 17 | wildfly-maven-plugin 18 | 19 | 20 | 21 | 22 | org.wildfly.channels 23 | wildfly 24 | WF_VERSION 25 | 26 | 27 | 28 | 29 | 30 | org.wildfly:wildfly-galleon-pack:WF_VERSION 31 | 32 | 33 | 34 | jaxrs-server 35 | 36 | 37 | deployment-scanner 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | /system-property=org.wildfly.maven.plugin-package-goal:add(value=true) 46 | 47 | 48 | 49 | test.war 50 | 51 | extra-content 52 | 53 | true 54 | packaged-channel-server 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/resources/test-project/package-multiple-deployments-pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 8 | 4.0.0 9 | testing 10 | testing 11 | 0.1.0-SNAPSHOT 12 | 13 | 14 | testing 15 | dummy 16 | 1.0 17 | system 18 | ${basedir}/dummy.jar 19 | 20 | 21 | testing 22 | dummy-test 23 | 1.0 24 | system 25 | ${basedir}/dummy-test.jar 26 | 27 | 28 | testing 29 | dummy-test-common 30 | 1.0 31 | system 32 | ${basedir}/dummy-test-common.jar 33 | 34 | 35 | org.junit.jupiter 36 | junit-jupiter 37 | 5.11.3 38 | test 39 | 40 | 41 | 42 | 43 | 44 | org.wildfly.plugins 45 | wildfly-maven-plugin 46 | 47 | test.war 48 | true 49 | packaged-multiple-deployments-server 50 | 51 | !testing:*test* 52 | ::jar 53 | 54 | test 55 | 56 | 57 | wildfly@maven(org.jboss.universe:community-universe)#WF_VERSION 58 | 59 | 60 | 61 | jaxrs-server 62 | 63 | 64 | 65 | true 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | 3 | = Contributing Guide 4 | 5 | Want to contribute to the WildFly Maven Plugin? We try to make it easy, and all contributions, even the smaller ones, 6 | are more than welcome. This includes bug reports, fixes, documentation, etc. First though, please read this page 7 | (including the small print at the end). 8 | 9 | == Legal 10 | 11 | All original contributions to the WildFly Maven Plugin are licensed under the 12 | https://www.apache.org/licenses/LICENSE-2.0[ASL - Apache License], version 2.0 or later, or, if another license is 13 | specified as governing the file or directory being modified, such other license. 14 | 15 | All contributions are subject to the https://developercertificate.org/[Developer Certificate of Origin (DCO)]. 16 | The DCO text is also included verbatim in the [dco.txt](dco.txt) file in the root directory of the repository. 17 | 18 | == Reporting an issue 19 | 20 | This project uses https://issues.redhat.com/browse/WFMP[JIRA] for filing issues. An account is required, However, 21 | if you do not wish to signup for an account, you can open a 22 | https://github.com/wildfly/wildfly-maven-plugin/discussions[discussion] and we will assist you in filing an issue. 23 | 24 | If you believe you found a bug, and it's likely possible, please indicate a way to reproduce it, what you are seeing and 25 | what you would expect to see. 26 | 27 | == Before you contribute 28 | 29 | To contribute, use GitHub Pull Requests, from your **own** fork. 30 | 31 | Also, make sure you have set up your Git authorship correctly: 32 | 33 | ---- 34 | git config --global user.name "Your Full Name" 35 | git config --global user.email your.email@example.com 36 | ---- 37 | 38 | If you use different computers to contribute, please make sure the name is the same on all your computers. 39 | 40 | We use this information to acknowledge your contributions in release announcements. 41 | 42 | == Setup 43 | 44 | If you have not done so on this machine, you need to: 45 | 46 | * Install Git and configure your GitHub access 47 | * Install Java SDK 17+ (OpenJDK recommended) 48 | 49 | === IDE Config and Code Style 50 | 51 | The WildFly Maven Plugin has a strictly enforced code style. Code formatting is done by the Eclipse code formatter, 52 | using the config files found in the 53 | https://github.com/wildfly/wildfly-dev-tools/tree/main/ide-config/src/main/resources[eclipse-code-formatter.xml] 54 | file. By default, when you run `./mvnw install`, the code will be formatted automatically. When submitting a pull 55 | request the CI build will fail if running the formatter results in any code changes, so it is recommended that you 56 | always run a full Maven build before submitting a pull request. 57 | 58 | If you want to run the formatting without doing a full build, you can run `mvn process-sources`. 59 | 60 | ==== Eclipse Setup 61 | 62 | Open the *Preferences* window, and then navigate to _Java_ -> _Code Style_ -> _Formatter_. Click _Import_ and then 63 | select the `eclipse-code-formatter.xml` downloaded from the above link or clone the repository and navigate to the file. 64 | 65 | Next navigate to _Java_ -> _Code Style_ -> _Organize Imports_. Click _Import_ and select the `eclipse.importorder` file. 66 | 67 | ==== IDEA Setup 68 | 69 | Install the https://plugins.jetbrains.com/plugin/6546-adapter-for-eclipse-code-formatter/[Adapter for Eclipse Code Formatter]. 70 | See the https://github.com/krasa/EclipseCodeFormatter#instructions[documentation] on how to configure the plugin. -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/cli/CliSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.cli; 6 | 7 | import java.io.File; 8 | import java.util.ArrayList; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * A CLI execution. 14 | * 15 | * @author jdenise 16 | */ 17 | public class CliSession { 18 | 19 | private List scripts = Collections.emptyList(); 20 | private List propertiesFiles = Collections.emptyList(); 21 | private String[] javaOpts = {}; 22 | boolean resolveExpressions = false; 23 | private List commands = new ArrayList<>(); 24 | 25 | /** 26 | * Set the list of CLI commands to execute. 27 | * 28 | * @param commands List of script CLI commands 29 | */ 30 | public void setCommands(List commands) { 31 | this.commands = commands; 32 | } 33 | 34 | /** 35 | * Get the list of CLI commands to execute. 36 | * 37 | * @return The list of CLI commands. 38 | */ 39 | public List getCommands() { 40 | return commands; 41 | } 42 | 43 | /** 44 | * Set the list of JVM options to pass to CLI process. 45 | * 46 | * @param javaOpts List of JVM Options. 47 | */ 48 | public void setJavaOpts(String[] javaOpts) { 49 | this.javaOpts = javaOpts; 50 | } 51 | 52 | /** 53 | * Get the list of JVM options to pass to CLI process. 54 | * 55 | * @return The list of Java Options 56 | */ 57 | public String[] getJavaOpts() { 58 | return javaOpts; 59 | } 60 | 61 | /** 62 | * Set the list of CLI script files to execute. 63 | * 64 | * @param scripts List of script file paths. 65 | */ 66 | public void setScripts(List scripts) { 67 | this.scripts = scripts; 68 | } 69 | 70 | /** 71 | * Get the list of CLI script files to execute. 72 | * 73 | * @return The list of file paths. 74 | */ 75 | public List getScripts() { 76 | return scripts; 77 | } 78 | 79 | /** 80 | * Set the properties files used when executing the CLI. 81 | * 82 | * @param propertiesFiles List of Path to properties file. 83 | */ 84 | public void setPropertiesFiles(List propertiesFiles) { 85 | this.propertiesFiles = propertiesFiles; 86 | } 87 | 88 | /** 89 | * Get the properties files used when executing the CLI. 90 | * 91 | * @return The properties file path. 92 | */ 93 | public List getPropertiesFiles() { 94 | return propertiesFiles; 95 | } 96 | 97 | /** 98 | * By default, the CLI doesn't resolve expressions located in scripts locally. In order to have the expressions 99 | * resolved locally, set this value to true. 100 | * 101 | * @param resolveExpressions True to resolve locally, false to resolve at server execution time. 102 | */ 103 | public void setResolveExpressions(boolean resolveExpressions) { 104 | this.resolveExpressions = resolveExpressions; 105 | } 106 | 107 | /** 108 | * Get the expression resolution value. 109 | * 110 | * @return The expression resolution value. 111 | */ 112 | public boolean getResolveExpression() { 113 | return resolveExpressions; 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /plugin/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | com.bernardomg.maven.skins 11 | docs-maven-skin 12 | ${version.com.bernardomg.maven.skins} 13 | 14 | 15 | 16 | 17 | WildFly Maven Plugin 18 | @WildFlyAS 19 | ./css/custom.css 20 | slate 21 | bg-primary 22 | rainbow 23 | 24 | Overview 25 | Examples 26 | Project Documentation 27 | Reports 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
66 |
67 | 70 |
71 | 72 | ]]>
73 | 74 |
75 | -------------------------------------------------------------------------------- /tests/shared/src/main/java/org/wildfly/plugin/tests/runner/WildFlyTestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.tests.runner; 7 | 8 | import java.lang.reflect.Field; 9 | import java.lang.reflect.Modifier; 10 | import java.util.ServiceLoader; 11 | 12 | import javax.inject.Inject; 13 | 14 | import org.jboss.as.controller.client.ModelControllerClient; 15 | import org.junit.runner.Result; 16 | import org.junit.runner.notification.RunListener; 17 | import org.junit.runner.notification.RunNotifier; 18 | import org.junit.runners.BlockJUnit4ClassRunner; 19 | import org.junit.runners.model.InitializationError; 20 | import org.wildfly.plugin.server.TestServer; 21 | import org.wildfly.plugin.tools.DeploymentManager; 22 | 23 | /** 24 | * @author James R. Perkins 25 | */ 26 | public class WildFlyTestRunner extends BlockJUnit4ClassRunner { 27 | private static final TestServer server; 28 | 29 | static { 30 | final ServiceLoader loader = ServiceLoader.load(TestServer.class); 31 | if (loader.iterator().hasNext()) { 32 | server = loader.iterator().next(); 33 | } else { 34 | throw new RuntimeException("No server implementation found"); 35 | } 36 | } 37 | 38 | /** 39 | * Creates a BlockJUnit4ClassRunner to run {@code clazz} 40 | * 41 | * @throws org.junit.runners.model.InitializationError if the test class is malformed. 42 | */ 43 | public WildFlyTestRunner(Class clazz) throws InitializationError { 44 | super(clazz); 45 | 46 | } 47 | 48 | @Override 49 | protected Object createTest() throws Exception { 50 | Object res = super.createTest(); 51 | doInject(getTestClass().getJavaClass(), res); 52 | return res; 53 | } 54 | 55 | @Override 56 | public void run(final RunNotifier notifier) { 57 | notifier.addListener(new RunListener() { 58 | @Override 59 | public void testRunFinished(Result result) throws Exception { 60 | super.testRunFinished(result); 61 | server.stop(); 62 | } 63 | }); 64 | server.start(); 65 | super.run(notifier); 66 | } 67 | 68 | private void doInject(final Class clazz, final Object instance) { 69 | Class c = clazz; 70 | try { 71 | while (c != null && c != Object.class) { 72 | for (Field field : c.getDeclaredFields()) { 73 | if (instance != null && !Modifier.isStatic(field.getModifiers())) { 74 | if (field.isAnnotationPresent(Inject.class)) { 75 | field.setAccessible(true); 76 | if (field.getType() == ModelControllerClient.class) { 77 | field.set(instance, server.getClient()); 78 | } else if (TestServer.class.isAssignableFrom(field.getType())) { 79 | field.set(instance, server); 80 | } else if (DeploymentManager.class.isAssignableFrom(field.getType())) { 81 | field.set(instance, server.getDeploymentManager()); 82 | } 83 | } 84 | } 85 | } 86 | c = c.getSuperclass(); 87 | } 88 | } catch (Exception e) { 89 | throw new RuntimeException("Failed to inject", e); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/ImageTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.wildfly.plugin.provision; 6 | 7 | import static org.wildfly.plugin.provision.ExecUtil.execSilentWithTimeout; 8 | import static org.wildfly.plugin.tests.AbstractWildFlyMojoTest.getPomFile; 9 | 10 | import java.io.ByteArrayOutputStream; 11 | import java.nio.file.Files; 12 | import java.nio.file.Path; 13 | import java.time.Duration; 14 | import java.util.List; 15 | 16 | import org.apache.maven.plugin.Mojo; 17 | import org.apache.maven.plugin.MojoExecutionException; 18 | import org.junit.Assume; 19 | import org.junit.Test; 20 | import org.junit.experimental.categories.Category; 21 | import org.wildfly.plugin.categories.ChannelsRequired; 22 | import org.wildfly.plugin.tests.AbstractWildFlyMojoTest; 23 | import org.wildfly.plugin.tests.TestEnvironment; 24 | 25 | @Category(ChannelsRequired.class) 26 | public class ImageTest extends AbstractImageTest { 27 | 28 | @Test 29 | public void testBuildImage() throws Exception { 30 | Assume.assumeFalse("This test is flaky on Windows, ignore it on Windows.", TestEnvironment.isWindows()); 31 | final String binary = ExecUtil.resolveImageBinary(); 32 | try { 33 | assertTrue( 34 | execSilentWithTimeout(Duration.ofMillis(3000), 35 | binary, "-v")); 36 | assertFalse( 37 | exec(binary, "inspect", "wildfly-maven-plugin/testing")); 38 | 39 | final Mojo imageMojo = lookupConfiguredMojo(getPomFile("image-pom.xml").toFile(), "image"); 40 | 41 | imageMojo.execute(); 42 | Path jbossHome = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("image-server"); 43 | assertTrue(jbossHome.toFile().exists()); 44 | Path dockerFile = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("Dockerfile"); 45 | assertTrue(dockerFile.toFile().exists()); 46 | List dockerfileLines = Files.readAllLines(dockerFile); 47 | assertLineContains(dockerfileLines, 1, "LABEL description=\"This text illustrates \\"); 48 | assertLineContains(dockerfileLines, 2, "that label-values can span multiple lines.\""); 49 | assertLineContains(dockerfileLines, 3, "LABEL quoted.line=\"I have \\\"quoted myself\\\" here.\""); 50 | assertLineContains(dockerfileLines, 4, "LABEL version=\"1.0\""); 51 | final ByteArrayOutputStream stdout = new ByteArrayOutputStream(); 52 | assertTrue(ExecUtil.exec(stdout, binary, "inspect", "wildfly-maven-plugin/testing")); 53 | assertEnvironmentUnset(stdout, "SERVER_ARGS=-c="); 54 | } finally { 55 | 56 | exec(binary, "rmi", "wildfly-maven-plugin/testing"); 57 | } 58 | } 59 | 60 | @Test(expected = MojoExecutionException.class) 61 | public void testBuildImageWithUnknownDockerBinary() throws Exception { 62 | final Mojo imageMojo = lookupConfiguredMojo( 63 | getPomFile("image-unknown-docker-binary-pom.xml").toFile(), "image"); 64 | imageMojo.execute(); 65 | } 66 | 67 | private static void assertLineContains(final List dockerfileLines, final int index, final String expected) { 68 | assertEquals( 69 | String.format("Expected Dockerfile to contain %s at line %d%n%s", expected, index, 70 | String.join(System.lineSeparator(), dockerfileLines)), 71 | expected, dockerfileLines.get(index)); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugin/deployment/DeployArtifactMojo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright The WildFly Authors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.wildfly.plugin.deployment; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.util.Objects; 11 | import java.util.Set; 12 | 13 | import org.apache.maven.artifact.Artifact; 14 | import org.apache.maven.plugins.annotations.Mojo; 15 | import org.apache.maven.plugins.annotations.Parameter; 16 | import org.apache.maven.plugins.annotations.ResolutionScope; 17 | import org.wildfly.plugin.common.PropertyNames; 18 | import org.wildfly.plugin.tools.Deployment; 19 | import org.wildfly.plugin.tools.DeploymentManager; 20 | import org.wildfly.plugin.tools.DeploymentResult; 21 | 22 | /** 23 | * Deploys an arbitrary artifact to the WildFly application server 24 | * 25 | * @author Stuart Douglas 26 | */ 27 | @Mojo(name = "deploy-artifact", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) 28 | public class DeployArtifactMojo extends AbstractDeployment { 29 | 30 | /** 31 | * The artifact to deploys groupId 32 | */ 33 | @Parameter 34 | private String groupId; 35 | 36 | /** 37 | * The artifact to deploys artifactId 38 | */ 39 | @Parameter 40 | private String artifactId; 41 | 42 | /** 43 | * The artifact to deploys classifier. Note that the classifier must also be set on the dependency being deployed. 44 | */ 45 | @Parameter 46 | private String classifier; 47 | 48 | /** 49 | * Specifies whether force mode should be used or not. 50 | *

51 | * If force mode is disabled, the deploy goal will cause a build failure if the application being deployed already 52 | * exists. 53 | */ 54 | @Parameter(defaultValue = "true", property = PropertyNames.DEPLOY_FORCE) 55 | private boolean force; 56 | 57 | /** 58 | * The resolved dependency file 59 | */ 60 | private File file; 61 | 62 | @Override 63 | public void validate(final boolean isDomain) throws MojoDeploymentException { 64 | super.validate(isDomain); 65 | if (artifactId == null) { 66 | throw new MojoDeploymentException("deploy-artifact must specify the artifactId"); 67 | } 68 | if (groupId == null) { 69 | throw new MojoDeploymentException("deploy-artifact must specify the groupId"); 70 | } 71 | final Set dependencies = project.getArtifacts(); 72 | Artifact artifact = null; 73 | for (final Artifact a : dependencies) { 74 | if (Objects.equals(a.getArtifactId(), artifactId) && 75 | Objects.equals(a.getGroupId(), groupId) && 76 | Objects.equals(a.getClassifier(), classifier)) { 77 | artifact = a; 78 | break; 79 | } 80 | } 81 | if (artifact == null) { 82 | throw new MojoDeploymentException("Could not resolve artifact to deploy " + groupId + ":" + artifactId); 83 | } 84 | file = artifact.getFile(); 85 | } 86 | 87 | @Override 88 | protected File file() { 89 | return file; 90 | } 91 | 92 | @Override 93 | public String goal() { 94 | return "deploy-artifact"; 95 | } 96 | 97 | @Override 98 | protected DeploymentResult executeDeployment(final DeploymentManager deploymentManager, final Deployment deployment) 99 | throws IOException { 100 | if (force) { 101 | return deploymentManager.forceDeploy(deployment); 102 | } 103 | return deploymentManager.deploy(deployment); 104 | } 105 | } 106 | --------------------------------------------------------------------------------