springboot项目初始化pom文件模板

通用pom.xml

<?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">
    
    <!-- pom模型版本 -->
    <modelVersion>4.0.0</modelVersion>
    
    <!-- 项目信息 -->
    <groupId>demo</groupId><!-- 项目唯一标识 -->
    <artifactId>springboot</artifactId><!-- 项目名 -->
    <version>0.0.1-SNAPSHOT</version><!-- 版本 -->
    <packaging>jar</packaging><!-- 打包方式 (pom,war,jar) -->

    <name>springboot</name><!-- 项目的名称, Maven 产生的文档用 -->
    <description>Demo project for Spring Boot</description><!-- 项目的描述, Maven 产生的文档用 -->

    <!-- 父级项目 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    <!-- 属性设置 -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><!-- 编译字符编码为utf-8 -->
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><!-- 输出字符编码为UTF-8  -->
        <java.version>1.8</java.version><!-- jdK版本 -->
    </properties>
    
    <!-- 依赖关系 -->
    <dependencies>
        
    </dependencies>
    
	<profiles>
		<profile>
			<id>dev</id>
			<activation>
				<actionByDefault>true</actionByDefault>
			</activation>
			<properties>
				<activeProperties>dev</activeProperties>
			</properties>
		</profile>
		<profile>
			<id>prod</id>
			<activation>
				<actionByDefault>true</actionByDefault>
			</activation>
			<properties>
				<activeProperties>prod</activeProperties>
			</properties>
		</profile>
		<profile>
			<id>test</id>
			<activation>
				<actionByDefault>true</actionByDefault>
			</activation>
			<properties>
				<activeProperties>test</activeProperties>
			</properties>
		</profile>
	</profiles>

    <!-- 编译 -->
    <build>
        <!-- 插件 -->
        <plugins>
            <!-- maven插件 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!--引入不在maven仓库的jar-->
                <configuration>
                	<includeSystemScope>true</includeSystemScope>
				</configuration>
            </plugin>
        </plugins>
		<!--资源过滤-->
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/resources</directory>
				<includes>
					<include>application.yml</include>
					<include>application-${activeProperties}.yml</include>
				</includes>
			</resource>
		</resources>
    </build>
</project>

application.yml

spring:
	profiles:
		active:@activeProperties@

你可能感兴趣的:(Java)