1.pom配置
<?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">
<!--maven的版本号-->
<modelVersion>4.0.0</modelVersion>
<!--通常用于子模块对父模块pom的继承-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!--用来聚合运行Maven项目,指定多个模块一起编译-->
<modules>
<module></module>
</modules>
<!--坐标-->
<!--公司网址反写+项目名-->
<groupId>com.leichuangkj.topicbet</groupId>
<!--项目名+模块名-->
<artifactId>football</artifactId>
<!--快照版本-->
<version>1.0-SNAPSHOT</version>
<!--打包方式-->
<!--打包方式,默认是jar,可选war、zip、pom-->
<packaging>jar</packaging>
<!--项目名称-->
<name>topicbet football</name>
<!--项目地址-->
<url>http://www.example.com</url>
<!--项目描述-->
<description>足球竞猜</description>
<!--开发人员列表-->
<developers>
<developer>Steven</developer>
</developers>
<!--属性-->
<properties>
<log4j.version>1.2.17</log4j.version>
</properties>
<!--依赖列表,整个项目都会包含-->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
<!--依赖的管理,作用主要定义在父模块中,对子模块进行管理-->
<dependencyManagement>
<dependencies>
<!-- 日志框架 -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!--项目级别的构建,基础配置-->
<build>
<finalName>demo</finalName>
<pluginManagement>
<!--插件列表-->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<!--环境隔离配置-->
<profiles>
<profile>
<id>dev</id>
<activation>
<!--默认激活的环境-->
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<deploy.type>dev</deploy.type>
</properties>
</profile>
</profiles>
</project>
2.build配置项
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${artifactId}-${version}</finalName>
<resources>
<resource>
<targetPath>META-INF/plexus</targetPath>
<!--是否使用过滤器-->
<filtering>false</filtering>
<directory>${basedir}/src/main/plexus</directory>
<includes>
<include>configuration.xml</include>
</includes>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.0</version>
<!--是否使用扩展-->
<extensions>false</extensions>
<!--是否可继承-->
<inherited>true</inherited>
<!--当前插件的配置-->
<configuration>
<classifier>test</classifier>
</configuration>
</plugin>
</plugins>
<!--通过扩展来修改插件的行 -->
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-3</version>
</extension>
</extensions>
</build>