pom.xml文件

<!--包名以及版本号,这个是打包时候使用,版本可写可不写,建议写有利于维护系统-->
<artifactId>tsgdemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!--打包形式-->
<packaging>war</packaging>


<!--该依赖的作用是:在项目打包时,剔除springboot内置tomcat。-->
<!--如果没有该步骤,打成的war包内,会有关于内置tomcat的多余的jar包,但是并不影响项目最终的部署与运行。-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

<!--加入SpringBoot打包插件(pom.xml)-->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

springboot项目启动文件:

@SpringBootApplication
@MapperScan("com.sise.tsgdemo.mapper") //扫描的mapper
public class TsgdemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(TsgdemoApplication.class, args);
        System.out.println("=======项目启动成功,欢迎使用=======");
    }
    //打包@Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(TsgdemoApplication.class);
    }
}

等maven加载完之后,准备打包:点击右侧的maven
先清理一下:clean,之后再package打包就行了
在这里插入图片描述

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐