首页 > 其他分享 >SpringBoot Maven 继承

SpringBoot Maven 继承

时间:2022-09-25 16:56:50浏览次数:52  
标签:SpringBoot 继承 spring 1.8 boot springframework Maven org starter

父项目

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>2.3.7.RELEASE</version>
    </parent>
    <packaging>pom</packaging>
    <groupId>com.example</groupId>
    <artifactId>spring</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring</name>
    <description>spring</description>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </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>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.7.RELEASE</version>
                <configuration>
                    <mainClass>com.example.spring.Application</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

子项目

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>2.3.7.RELEASE</version>
    </parent>
    <!-- 异常:Invalid packaging for parent POM com.example:spring:0.0.1-SNAPSHOT (D:\IdeaProjects\spring\pom.xml), must be "pom" but is "jar" -->
    <packaging>pom</packaging>
    <groupId>com.example</groupId>
    <artifactId>spring</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring</name>
    <description>spring</description>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </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>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.7.RELEASE</version>
                <configuration>
                    <mainClass>com.example.spring.Application</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

标签:SpringBoot,继承,spring,1.8,boot,springframework,Maven,org,starter
From: https://www.cnblogs.com/liuzonglin/p/16728161.html

相关文章

  • c#-03关于类和继承的基本知识
    一、类继承通过类继承可以定义一个新类,新类纳入一个已经声明的类进行扩展已经存在的类叫做基类,而通过继承出的类叫做派生类,派生类的组成为:本身声明中的成员基类的成......
  • 计算机毕业设计 SpringBoot+Vue招投标系统 招标系统 投标系统 招标采购系统Java Vue M
    ......
  • JavaWeb--Maven--2022年9月25日
    第一节  Maven引言1.Maven主要功能提供了一套标准化的项目结构提供了一套标准化的构建流程(编译,测试,打包,发布....)提供了一套依赖管理......
  • SpringBoot集成onlyoffice实现word文档编辑保存
    说明onlyoffice为一款开源的office在线编辑组件,提供word/excel/ppt编辑保存操作以下操作均基于centos8系统,officeonly镜像版本7.1.2.23镜像下载地址:https://yunpan.360......
  • camunda_06_quickstart_springboot
    目标在SpringBoot项目中集成Camunda流程引擎,并启动启动一个流程实例了解集成Camunda需要调整哪些配置pom.xml最简单的方式是使用camunda的SpringBoot向导生成......
  • springboot中使用mybatisplus自带插件实现分页
    springboot中使用mybatisplus自带插件实现分页1.导入mybatisplus分页依赖<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-......
  • Servlet和Maven项目
    Servlet执行流程通过默认端口号访问到Tomcat服务器通过类名访问到对应的项目通过自定义的相应路径,访问到注释中的同名路径即为执行流程相应的Servlet对象由Tomcat服务......
  •  Springboot项目引入swagger2
    Springboot项目引入swagger2前言swagger是一个规范和完整的框架,用于生成、描述、调用和可视化的restful风格的web服务框架,总体目标是使客户端和文件系统作为服务器以同......
  • 【Maven】Maven实战总结(一) Maven与Nexus
    背景Maven是Java项目中常用的项目管理工具,每天工作都要与Maven打交道,最近有时间了,借此机会总结Maven的使用经验通过Maven实战总结系列文章去梳理Maven中的技术点......
  • SpringBoot配置
    1.创建普通web项目2.在pom.xml里添加依赖<!--SpringBoot启动父依赖--><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-......