Wildfly Deploy Maven

I want to deploy a war that I have created using maven to wildfly using the wildfly-maven-plugin.


The final name of the war is something like: my-war-1.0.war
The war also contains a jboss-web.xml specifying the context root (eg /my-war)


Problem Description

If I now deploy the war to wildfly I will get a "my-war-1.0.war" deployment .
If I later want to deploy a new version (eg the war is now named my-war-1.1.war ) I get a conflict as the context root is already known but the deployment has a new name.


Is there a way using the wildfly-maven-plugin to deploy a "my-war.war" instead?

I need to keep the original final build name inside the maven build for versioning and deploying to our nexus.


The simplest solution is to use the <finalName/> element on the <build/> configuration.

<build>
    <finalName>${project.artifactId}</finalName>
</build>

You can use the maven war plugin to rename the final war. For Eg:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <warName>my-war</warName>
            </configuration>
        </plugin>
    </plugins>
</build>

This will always generate the war with the name my-war.war in your "target" directory.


I found out that I can use the parameters <name/> and <runtimeName/> inside the <configuration/> of the maven-wildfly-plugin.

That way I can specify what the deployment should be called on the server and each time just replace it. It is important to have the two parameters end in ".war" , otherwise you will get a 404 error.

Using this method I can keep the original name of the final build result containing the version (my-app-1.0.war) and archive it inside our internal nexus repository.

链接地址: http://www.djcxy.com/p/79976.html

上一篇: 在Maven上保留Maven工件名称

下一篇: Wild Dep部署Maven