pom.xml文件指定jdk版本号/跳过测试
生活随笔
收集整理的这篇文章主要介绍了
pom.xml文件指定jdk版本号/跳过测试
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
注意:maven在默认是用jdk1.5版本来编译java文件
想要改变其默认设置,可以通过添加插件方式
以下是pom.xml文件配置
<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>com.chinasofti</groupId><!-- 工程名 --><artifactId>web01</artifactId><!-- 打包类型 --><packaging>war</packaging><!-- 版本 --><version>0.0.1-SNAPSHOT</version><name>web01 Maven Webapp</name><url>http://maven.apache.org</url><!-- 指定依赖jar --><dependencies><!-- junit单元测试 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.10</version><!-- test 仅测试时依赖该jar compile 编译期使用 --><scope>test</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>compile</scope></dependency><dependency><groupId>com.chinasofti</groupId><artifactId>commons</artifactId><version>0.0.1-SNAPSHOT</version></dependency></dependencies><build><!-- finalName指定打包生成的文件名,默认为工程名-版本号 --><finalName>web01</finalName><plugins><!-- 指定jdk版本 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.1</version><configuration><!-- 源码的编译器版本 --><source>1.8</source><!-- class的编译器版本 --><target>1.8</target></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><configuration><!-- 跳过测试 --><skip>true</skip></configuration><version>2.18.1</version></plugin></plugins></build> </project> <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>com.chinasofti</groupId><!-- 工程名 --><artifactId>web01</artifactId><!-- 打包类型 --><packaging>war</packaging><!-- 版本 --><version>0.0.1-SNAPSHOT</version><name>web01 Maven Webapp</name><url>http://maven.apache.org</url><!-- 指定依赖jar --><dependencies><!-- junit单元测试 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.10</version><!-- test 仅测试时依赖该jar compile 编译期使用 --><scope>test</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>compile</scope></dependency><dependency><groupId>com.chinasofti</groupId><artifactId>commons</artifactId><version>0.0.1-SNAPSHOT</version></dependency></dependencies><build><!-- finalName指定打包生成的文件名,默认为工程名-版本号 --><finalName>web01</finalName><plugins><!-- 指定jdk版本 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.1</version><configuration><!-- 源码的编译器版本 --><source>1.8</source><!-- class的编译器版本 --><target>1.8</target></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><configuration><!-- 跳过测试 --><skip>true</skip></configuration><version>2.18.1</version></plugin></plugins></build> </project>
转载于:https://www.cnblogs.com/azhi/p/9134461.html
总结
以上是生活随笔为你收集整理的pom.xml文件指定jdk版本号/跳过测试的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: ORACLE同义词源库锁表导致目标库删除
- 下一篇: 第三方插件——分享