java - Invalid packaging for parent POM must be "pom" but is "war" -


could suggest me solution following exception. going create 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 tried run maven project parent (clean+install) got error :

[info] scanning projects... [error] [error] problems encountered while processing poms: [error] invalid packaging parent pom lu.pgd:webbusiness:0.0.1-snapshot, must "pom" "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 parent pom lu.pgd:webbusiness:0.0.1-snapshot, must "pom" "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] build not read 2 projects -> [help 1] [error]    [error]   project lu.pgd:ccpd-ear:0.0.1-snapshot (c:\users\x279\workspace\spdv_ear\pom.xml) has 1 error [error]     invalid packaging parent pom lu.pgd:webbusiness:0.0.1-snapshot, must "pom" "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]   project lu.pgd:webbusiness-war:0.0.1-snapshot (c:\users\x279\workspace\webbusiness\pom.xml) has 1 error [error]     invalid packaging parent pom lu.pgd:webbusiness:0.0.1-snapshot, must "pom" "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 me here understand going wrong here please ?

enter image description here

enter image description here

usually folder structure multi-module project this:

- parent-project-folder   - pom.xml (parent-project)   - submodule-project-folder     - pom.xml (submodule-project)   - another-submodule-project-folder     - pom.xml (another-submodule-project) 

then parent definition have fine, have parent project next submodules, need configure bit more.

try adding relativepath parent specifications:

<parent>    <groupid>...    ...    <relativepath>path/to/your/parent/pom.xml</relativepath> </parent> 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -