70 lines
2.9 KiB
XML
70 lines
2.9 KiB
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">
|
||
|
<modelVersion>4.0.0</modelVersion>
|
||
|
|
||
|
<groupId>org.example</groupId>
|
||
|
<artifactId>http</artifactId>
|
||
|
<version>1.0-SNAPSHOT</version>
|
||
|
|
||
|
<properties>
|
||
|
<!-- 指定 maven 编译时用的 jdk 版本,与 maven 基础镜像中的版本一致 -->
|
||
|
<maven.compiler.source>11</maven.compiler.source>
|
||
|
<maven.compiler.target>11</maven.compiler.target>
|
||
|
</properties>
|
||
|
|
||
|
<build>
|
||
|
<!-- 指定项目最终生成的 jar 文件名,建议固定下来,方便在 Dockerfile 中 COPY 固定文件名 -->
|
||
|
<finalName>app</finalName>
|
||
|
<plugins>
|
||
|
<plugin>
|
||
|
<!-- 将项目源码编译成一个可执行 jar 包 -->
|
||
|
<groupId>org.apache.maven.plugins</groupId>
|
||
|
<artifactId>maven-jar-plugin</artifactId>
|
||
|
<configuration>
|
||
|
<archive>
|
||
|
<manifest>
|
||
|
<!-- 运行 jar 包时运行的主类,要求类全名 -->
|
||
|
<mainClass>org.example.http.HttpTest</mainClass>
|
||
|
<!-- 是否指定项目 classpath 下的依赖 -->
|
||
|
<addClasspath>true</addClasspath>
|
||
|
<!-- 指定依赖的时候声明前缀 -->
|
||
|
<classpathPrefix>./lib/</classpathPrefix>
|
||
|
<!-- 依赖是否使用带有时间戳的唯一版本号,如:xxx-1.3.0-20121225.012733.jar -->
|
||
|
<useUniqueVersions>false</useUniqueVersions>
|
||
|
</manifest>
|
||
|
</archive>
|
||
|
</configuration>
|
||
|
</plugin>
|
||
|
<plugin>
|
||
|
<!-- 利用 maven-dependency-plugin 把当前项目的所有依赖放到 target 目录下的 lib 文件夹下 -->
|
||
|
<groupId>org.apache.maven.plugins</groupId>
|
||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||
|
<executions>
|
||
|
<execution>
|
||
|
<id>copy</id>
|
||
|
<phase>package</phase>
|
||
|
<goals>
|
||
|
<goal>copy-dependencies</goal>
|
||
|
</goals>
|
||
|
<configuration>
|
||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||
|
</configuration>
|
||
|
</execution>
|
||
|
</executions>
|
||
|
</plugin>
|
||
|
</plugins>
|
||
|
</build>
|
||
|
|
||
|
<dependencies>
|
||
|
<dependency>
|
||
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||
|
<artifactId>httpclient5</artifactId>
|
||
|
<version>5.1.3</version>
|
||
|
</dependency>
|
||
|
</dependencies>
|
||
|
|
||
|
</project>
|
||
|
|