简体   繁体   中英

Maven, Inherit pom module

I am writing a project but I encountered a problem compiling my project. After I imported the necessary dependencies, as shown on the pom file, I couldnt run the project.

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>


  <artifactId>universeBySali-web</artifactId>
  <packaging>war</packaging>

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

    <properties>
        <java.version>13.0.2</java.version>
     </properties>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <version>15.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sali</groupId>
            <artifactId>universeBySali-ui</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

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

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
  </build>
</project>

The error that it shows on the pom file is as follows:

Project build error: 'parent.relativePath' of POM org.springframework.boot:universeBySali-web:1.3.6.RELEASE (C:\\Users\\User\\Desktop\\Materiale\\Desktop\\Java Projects\\universeBySali\\universeBySali-web\\pom.xml) points at com.sali:universeBySali instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure

This pom file has a parent pom as shown below:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sali</groupId>
  <artifactId>universeBySali</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <modules>
    <module>universeBySali-Model</module>
    <module>universeBySali-repository</module>
    <module>universeBySali-service</module>
    <module>universeBySali-util</module>
    <module>universeBySali-web</module>
    <module>universeBySali-ui</module>
  </modules>
</project>

Can somebody tell me what I am doing wrong?? Thanks

By default Maven assumes the parent has the following relativePath: ../pom.xml . Maven will try to match match the groupId/artifactId/version, if it doesn't succeed a warning is thrown and an "external" parent is used. To ensure Maven won't try to solve the parent as part of your multimodule, you should add <relativePath/> to the parent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM