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同义词源库锁表导致目标库删除
- 下一篇: 第三方插件——分享