springboot使用maven打包

编程

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.2.6.RELEASE</version>

<relativePath/>

</parent>

<groupId>com.test</groupId>

<artifactId>test</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>war</packaging>

<name>test</name>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<java.version>1.8</java.version>

<!-- install打包时跳过单元测试的运行,跳过测试代码的编译 -->

<maven.test.skip>true</maven.test.skip>

</properties>

<dependencies>

</dependencies>

<build>

<finalName>test</finalName>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.1</version>

<configuration>

<source>${java.version}</source>

<target>${java.version}</target>

<encoding>${project.build.sourceEncoding}</encoding>

<compilerArguments>

<extdirs>${project.basedir}/lib</extdirs>

</compilerArguments>

</configuration>

</plugin>

</plugins>

</build>

</project>

二、引用外部jar,打包时一起打入(maven-dependency-plugin)

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-parent</artifactId>

<version>2.2.6.RELEASE</version>

<relativePath/> <!-- lookup parent from repository -->

</parent>

<groupId>com.test</groupId>

<artifactId>test</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>war</packaging>

<name>test</name>

<properties>

<java.version>1.8</java.version>

<!-- install打包时跳过单元测试的运行,跳过测试代码的编译 -->

<maven.test.skip>true</maven.test.skip>

</properties>

<dependencies>

<!--本地jar包引入-->

<dependency>

<groupId>com.loca</groupId>

<artifactId>ojdbc</artifactId>

<version>10.2.0.1</version>

<scope>system</scope>

<systemPath>${project.basedir}/src/main/lib/ojdbc14-10.2.0.1.0.jar</systemPath>

</dependency>

</dependencies>

<build>

<finalName>test</finalName>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-dependency-plugin</artifactId>

<version>2.10</version>

<executions>

<execution>

<id>copy-dependencies</id>

<phase>compile</phase>

<goals>

<goal>copy-dependencies</goal>

</goals>

<configuration>

<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>

<includeScope>system</includeScope>

</configuration>

</execution>

</executions>

</plugin>

</plugins>

</build>

</project>

 

以上是 springboot使用maven打包 的全部内容, 来源链接: utcz.com/z/516424.html

回到顶部