Could anybody suggest me an solution with the following exception. I am going to create a multi-module project. (War, Ear)
pom.xml (war)
<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>
<parent>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WebBusiness-war</artifactId>
<packaging>war</packaging>
<name>Web Business</name>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<slf4j.version>1.7.5</slf4j.version>
</properties>
<build>
<finalName>webBusiness</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (ear)
<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>
<parent>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>spdv-ear</artifactId>
<packaging>ear</packaging>
<name>Project EAR</name>
<dependencies>
<dependency>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<finalName>WebBusiness</finalName>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<applicationId>WebBusiness</applicationId>
<displayName>SPDV (${project.version})</displayName>
<modules>
<webModule>
<groupId>lu.pgd</groupId>
<artifactId>WebBusiness-war</artifactId>
<contextRoot>/WebBusiness</contextRoot>
<moduleId>war</moduleId>
</webModule>
</modules>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
</plugins>
</build>
</project>
pom.xml (parent)
<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>lu.pgd</groupId>
<artifactId>WebBusiness</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Parent Project</name>
<modules>
<module>../SPDV_EAR</module>
<module>../WebBusiness</module>
</modules>
<packaging>pom</packaging>
</project>
When I tried to Run Maven Project Parent (Clean+Install) I got error like :
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" @ lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" @ lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
@
[ERROR] The build could not read 2 projects -> [Help 1]
[ERROR]
[ERROR] The project lu.pgd:ccpd-ear:0.0.1-SNAPSHOT (C:\Users\x279\workspace\SPDV_EAR\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" @ lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
[ERROR] The project lu.pgd:WebBusiness-war:0.0.1-SNAPSHOT (C:\Users\x279\workspace\WebBusiness\pom.xml) has 1 error
[ERROR] Invalid packaging for parent POM lu.pgd:WebBusiness:0.0.1-SNAPSHOT, must be "pom" but is "war" @ lu.pgd:WebBusiness:0.0.1-SNAPSHOT, C:\dev\lu\pgd\WebBusiness\0.0.1-SNAPSHOT\WebBusiness-0.0.1-SNAPSHOT.pom, line 7, column 13
Could anybody help me here to understand what is going wrong here please ?
Usually the folder structure for a multi-module project is like this:
Then the parent definition you have would be fine, but you have the parent project next to your submodules, so you need to configure a bit more.
Try adding relativePath to your parent specifications: