Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven can't deploy from parent pom

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

like image 553
claim Avatar asked May 15 '14 13:05

claim


2 Answers

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>
like image 65
James R. Perkins Avatar answered Nov 11 '22 12:11

James R. Perkins


You application EAR is probably not located in parent project build folder. It's probably located in APP module build project. If you look here: you will see, there is targetDir defaulting to build directory of current project. You can provide another value. And filename parameter points to filename. It defaults to ${project.build.finalName}.${project.packaging}, and in your case it doesn't have a meaningful extension.

You may want to try something like

        <configuration>
            <targetDir>path</targetDir>
            <filename>filename</filename>
        </configuration> 

to your plugin defenition. You can use relative path of course. You may also try to run your plugin from APP project.

like image 37
skegg99 Avatar answered Nov 11 '22 14:11

skegg99