Java – parent POM Invalid wrapper for XML, must be ‘POM’, but ‘ear’
•
Java
Someone can suggest a solution, with the following exceptions I'm going to create a multi - module project
The parent project name is logicbackend and the child project name is dbaccess
I need a logicbackend headset file, which should contain the dbaccess prjoects jar file
When I run MAV clean install - P developer, I get the following exception
[ERROR]The project com.project1.Database:DBAccess:1.0-SNAPSHOT (C:\Project1\DBAccess\pom.xml) has 1 error [ERROR]Invalid packaging for parent POM com.project1.logic:LOGIC:1.0-SNAPSHOT (C:\Project1\pom.xml),must be "pom" but is "ear" @ com.project1.logic:LOGIC:1.0-SNAPSHOT,C:\Project1\pom.xml,line 6,column 13
This is my father POM Part of XML
<modelVersion>4.0.0</modelVersion> <groupId>com.project1.logic</groupId> <artifactId>LOGICBACKEND</artifactId> <packaging>ear</packaging> <version>1.0-SNAPSHOT</version>
This is the child POM What XML looks like
<groupId>com.project1.logic</groupId> <artifactId>DBAccess</artifactId> <packaging>ejb</packaging> <name>DBAccess</name> <version>1.0-SNAPSHOT</version> <parent> <groupId>com.project1.logic</groupId> <artifactId>DBAccess</artifactId> <version>1.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent>
Someone helped me understand what's wrong here
Thank you in advance for any help
Solution
This simple setup is a good start
. ├── pom.xml ├── services | ├── pom.xml | └── src | └── main | └── java | └── com | └── stackoverflow | └── MyEjbService.java └── application └── pom.xml
POM xml
<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>com.stackoverflow.Q13330930</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>${project.artifactId}-${project.version}</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <modules> <module>services</module> <module>application</module> </modules> <dependencies> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>com.stackoverflow.Q13330930</groupId> <artifactId>services</artifactId> <version>${project.version}</version> <type>ejb</type> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <artifactId>maven-ejb-plugin</artifactId> <version>2.3</version> <configuration> <ejbVersion>3.1</ejbVersion> </configuration> </plugin> </plugins> </build> </project>
Service / POM XML
<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>com.stackoverflow.Q13330930</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> </parent> <groupId>com.stackoverflow.Q13330930</groupId> <artifactId>services</artifactId> <packaging>ejb</packaging> <name>${project.artifactId}-${project.version}</name> </project>
Application / POM XML
<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>com.stackoverflow.Q13330930</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> </parent> <groupId>com.stackoverflow.Q13330930</groupId> <artifactId>application</artifactId> <packaging>ear</packaging> <name>${project.artifactId}-${project.version}</name> <dependencies> <dependency> <groupId>com.stackoverflow.Q13330930</groupId> <artifactId>services</artifactId> <type>ejb</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-ear-plugin</artifactId> <version>2.7</version> <configuration> <defaultLibBundleDir>lib</defaultLibBundleDir> </configuration> </plugin> </plugins> </build> </project>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码