wildfly.maven.plugin deploys nothing if packaging is set to pom

419 Views Asked by At

I am using Maven in order to automatically download a dependency, set up (and start) the JBoss server and deploy that downloaded dependency there. I created a pom.xml, which uses several Maven-Plugins. For JBoss-related interactions I am using the wildfly-maven.plugin (currently version 2.0.1.Final).

Since I am not building an artifact, but rather downloading it, I am not really producing a JAR (or any archived artifact).

The problem I currently have is: the wildfly-maven-plugin does not seem to do anything if packaging is set to pom.

As a workaround I currently set the project packaging to JAR and added the following to prevent the project JAR from building:

<properties>
    <jar.skipIfEmpty>true</jar.skipIfEmpty>
    <maven.install.skip>true</maven.install.skip>
</properties>

Update 04.03 This is what my pom.xml basically looks like:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>some.group</groupId>
    <artifactId>artifact</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>~y</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <maven.install.skip>true</maven.install.skip>
        <jar.skipIfEmpty>true</jar.skipIfEmpty>

        <plugin.wildfly.version>2.0.1.Final</plugin.wildfly.version>
        <plugin.wildfly.jboss-home>D:\server\jboss-eap-7.1</plugin.wildfly.jboss-home>
        <plugin.wildfly.hostname>localhost</plugin.wildfly.hostname>
        <plugin.wildfly.port>9990</plugin.wildfly.port>
        <plugin.wildfly.debug.port>9991</plugin.wildfly.debug.port>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${plugin.wildfly.version}</version>
                <configuration>
                    <jboss-home>${plugin.wildfly.jboss-home}</jboss-home>
                    <id>local-jboss</id>
                    <hostname>${plugin.wildfly.hostname}</hostname>
                    <port>${plugin.wildfly.port}</port>
                    <filename>y.ear</filename>
                    <force>true</force>
                </configuration>
                <executions>
                    <execution>
                        <id>deploy-ear</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-only</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I will give deploy-artifact a try, but in general I'd expect the wildfly.maven.plugin to work even if <packaging> is set to pom.

Maven command on commandline to build it: mvn clean install.

My real pom.xml is a bit more complex, but if it'd work using this simple pom.xml, I could make it work in the more complex one that I use.

2

There are 2 best solutions below

0
On BEST ANSWER

wildfly-maven-plugin does not seem to do anything if packaging is set to pom. Using the packaging-type jar along with jar.skipIfEmpty helps.

When using wildfly-maven-plugin's deploy-only goal, publishing works (through the management interface).

1
On

Have a look at the deploy-artifact goal. There is an example of it in the documentation.