user13663861
user13663861

Reputation:

Occurred an error while packaging spring-boot application by maven

The IDEA app told me that Invalid packaging for parent POM org.springframework.boot:spring-boot-starter-web:1.5.9.RELEASE, must be "pom" but is "jar" while I packaged my easy-start spring-boot application, how to solve this problem? My platform is macOS 10.15.7 with 3 JDKs(1.8, 11, 14), and I am using maven-3.6.3, my maven settings are also changed the JDK to 1.8 and 11 The pom.xml file is as followed:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>SpringBoot-01-HelloWorld</artifactId>
    <version>1.0</version>

    <packaging>pom</packaging>

    <parent>
        <artifactId>spring-boot-starter-web</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>1.5.9.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

Upvotes: 0

Views: 332

Answers (1)

Beppe C
Beppe C

Reputation: 13893

The parent POM should be the Spring Boot parent project

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
</parent>

Upvotes: 1

Related Questions