Maven POM 模板[z]

https://juejin.im/post/5cc826a5f265da03a33c443a

[z]https://juejin.im/post/5cc826a5f265da03a33c443a

SpringBoot POM:

https://start.spring.io

单独项目的 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>[GROUP ID]</groupId>
    <artifactId>[ARTIFACT_ID]</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <!-- 基本属性和自定义属性 -->
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <!-- 依赖关系 -->
    <dependencies>
    </dependencies>

    <build>
        <plugins>
          
            <!-- 如果需要对源代码打包 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- 如果需要打包的时候拷贝依赖库 -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <!-- 如果项目需要分发到仓库 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <!-- 项目分发的仓库配置 -->
    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>public</name>
            <url>http://[repository-server]/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>Snapshots</name>
            <url>http://[repository-server]/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>
原文地址:https://www.cnblogs.com/jjj250/p/10825701.html