Maven can't deploy from parent pom

claim picture claim · May 15, 2014 · Viewed 7.6k times · Source

i have just started building applications with Maven. One of my approaches is to build a multimodule web application. Working with Eclipse makes it very easy to build that kind of an application. So far everything works fine. The point at which i fail is the deployment. I am using Wildfly as my application Server and the deployment of the presentation layer works well. But when i want to deploy from the parent project i get this message:

Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.1.Final:deploy (default-cli) on project build: Error executing FORCE_DEPLOY: C:\Users\*****\Desktop\workspace\mvnexbook-examples-1.0\ch-multi\target\parent-0.8-SNAPSHOT.maven-project (No such file or directory)

This is very confusing. Does the deployment not take place from the previously installed files at the .m2/repository folder? Do i need a target directory in my parent folder?

My parent pom file

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.sonatype.mavenbook.multi</groupId>
        <artifactId>simple-parent</artifactId>
        <version>0.8-SNAPSHOT</version>
    </parent>

    <artifactId>simple-webapp</artifactId>
    <packaging>war</packaging>
    <name>Multi Chapter Simple Web Application Project</name>
    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-servlet_2.4_spec</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.sonatype.mavenbook.multi</groupId>
            <artifactId>simple-weather</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>simple-webapp</finalName>
        <plugins>

            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

EDIT: I just tried it with jetty. Works fine. Why it's not working with Wildfly?

EDIT2: I am using the simple-parent-project example from the sonatype book

Answer

James R. Perkins picture James R. Perkins · May 16, 2014

In the parent POM you need to add <skip>true</skip> to the configuration. Then set it to false for the your WAR POM.

Parent POM

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.0.1.Final</version>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

WAR POM

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <configuration>
        <skip>false</skip>
    </configuration>
</plugin>