jersey-ninja
jersey-ninja

Reputation: 1158

Wildfly Maven Plugin ignores deployment name?

I added the name parameter on my deployment using Wildfly Maven Plugin:

mvn wildfly:deploy -Dname=myapp  -Dwildfly.hostname=myserver -Dwildfly.username=user -Dwildfly.password=pwd 

However, it keeps on deploying with the Maven version and extension. Here's how it looks in standalone.xml

<deployment name="myapp-1.1-SNAPSHOT.war" runtime-name="myapp-1.1-SNAPSHOT.war">
    <content sha1="17e09de2cd8f78ffd033a90b4e82bdb52eb9485b"/>
</deployment>

The reason is to streamline the deployment process. After a Maven release, the deployment name changes to myapp-1.1.war, and the new development becomes myapp-1.2-SNAPSHOT.war. Instead of undeploying release myapp-1.1.war, and deploying myapp-1.2-SNAPSHOT.war, we want to reduce it to a single step - just redeploy myapp, and it should overwrite the old one.

Btw, if I just deploy, I'll have the two versions.

Just to be clear, this is the goal:

<deployment name="myapp" runtime-name="myapp-1.1-SNAPSHOT.war">
    <content sha1="17e09de2cd8f78ffd033a90b4e82bdb52eb9485b"/>
</deployment>

This seems like a very simple case, and it should work as per the documentation: https://docs.jboss.org/wildfly/plugins/maven/latest/deploy-mojo.html

Upvotes: 4

Views: 2280

Answers (1)

James R. Perkins
James R. Perkins

Reputation: 17825

You can't override the name parameter on the via the command line. You'd need to add a configuration property for the name configuration parameter and override that on the command line.

...
<properties>
    <deployment.name>${project.build.finalName}.${project.packaging}</deployment.name>
</properties>
...
<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.1.0.Alpha7</version>
    <configuration>
        <name>${deployment.name}</name>
    </configuration>
</plugin>
...

Then on the command you could use -Ddeployment.name=myapp. One note though is you'll want to use the appropriate file extension, e.g. .war, so the deployment will be processed properly.

Upvotes: 1

Related Questions