(1) 說明:該插件生成項目的javadoc.對於構建jar目標,javadoc會首先生成並打包放入jar文件中。java
(2) 默認用法:apache
- pom.xml配置
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.10.4</version> <configuration> ... </configuration> </plugin> </plugins> ... </build> ... </project>
- 執行命令
mvn javadoc:javadoc mvn javadoc:jar mvn javadoc:aggregate mvn javadoc:aggregate-jar mvn javadoc:test-javadoc mvn javadoc:test-jar mvn javadoc:test-aggregate mvn javadoc:test-aggregate-jar
(3) 擴展配置:併發
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9</version> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal><!--執行goal時,完成doc附加--> </goals> </execution> </executions> </plugin>
(1) 說明:在target目錄中生成當前項目的源文件的jar包。socket
(2) 默認用法:maven
- pom.xml配置
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
- 執行命令:
- source:aggregate 合併全部模塊的源碼;
- source:jar 用於項目主源碼的打包歸檔;
- source:test-jar 用於項目測試源碼的打包歸檔;
- source:jar-no-fork 相似於source:jar, 但不會fork進程來構建週期
- source:test-jar-no-fork 相似於source:test-jar, 但不會fork進程來構建週期。
(3) 擴展配置:ide
- 綁定階段
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ... </project>
- 在profile中使用
<project> ... <profiles> <profile> <id>release</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> ... </project>
(1) 說明:指定項目編譯使用的jdk。單元測試
(2) 默認用法:測試
- pom.xml配置
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <encoding>UTF-8</encoding> </configuration> <executions> <execution> <id>default-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin>
- 執行命令
compiler:compile 綁定compile階段,編譯main源碼網站
compiler:testCompile 綁定test-compile階段,編譯test源碼ui
(3) 擴展配置:沒有executions 標籤。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <!-- 源代碼使用的開發版本 --> <target>1.7</target> <!-- 須要生成的目標class文件的編譯版本 --> <!-- 通常而言,target與source是保持一致的,可是,有時候爲了讓程序能在其餘版本的jdk中運行(對於低版本目標jdk,源代碼中須要沒有使用低版本jdk中不支持的語法),會存在target不一樣於source的狀況 --> <!-- 這下面的是可選項 --> <meminitial>128m</meminitial> <maxmem>512m</maxmem> <fork>true</fork> <!-- fork is enable,用於明確表示編譯版本配置的可用 --> <compilerVersion>1.3</compilerVersion> <!-- 這個選項用來傳遞編譯器自身不包含可是卻支持的參數選項 --> <compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar</compilerArgument> </configuration> </plugin>
(1) 說明:該插件處理項目的資源文件拷貝到輸出目錄。能夠分別處理main resources 和 test resources。
(2) 默認用法:
- pom.xml配置:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.0.1</version> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <!--最好先指定過以下屬性—><properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> ... </properties>
- 執行命令:
resources:resources 拷貝主源碼的資源文件到output目錄;這個goals一般自動運行。
一般使用project.build.resources 元素來指定資源,默認拷貝到project.build.outputDirectory指定的目錄。
resources:testResources 拷貝測試源碼的資源文件到output目錄;這個goals一般自動運行。
一般使用project.build.testResources元素來指定測試資源,默認拷貝到project.build.testOutputDirectory目錄。
resources:copy-resources 拷貝資源到一個輸出目錄。這個goals要求將指定的資源拷貝到指定的outputDirectory中。
(3) 擴展配置:
<project> ... <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource> <directory>src/non-packaged-resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
(1) 說明:在構建期間執行單元測試。產生2種格式的測試案例執行報告:*.txt, *.xml。默認狀況下,這些結果文件存放在${basedir}/target/surefire-reports下。
(2) 默認用法:
- pom.xml配置
<plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <systemPropertyVariables> <!--指定參數,也能夠經過testng的@Parameter註解進行指定--><propertyName>firefox</propertyName></systemPropertyVariables> </configuration> </plugin> [...] </plugins><plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <!--指定組--> <groups>functest,perftest</groups> </configuration> </plugin> [...] </plugins>
- 執行命令:
- surefire:test :運行單元測試案例;
- mvn -Dmaven.surefire.debug test :debug測試案例(5005端口)
- mvn –Dmaven.surefire.debug="-Xdebug –Xrunjdwp:transport=dt_socket, server=y,suspend=y,address=8000 –Xnoagent –Djava.compiler=NONE" test :自定義8000端口進行debug
- mvn –DforkCount=0 test :強制maven不會fork進程執行案例。
- mvnDebug -DforkCount=0 test :debug maven自身。
(3) 擴展配置:
</plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <!--並行運行參數--> <parallel>methods</parallel> <threadCount>10</threadCount> </configuration> </plugin> [...] </plugins><plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <properties> <property> <name>parallel</name> <value>methods</value> </property> <property> <!--使用dataprovider並行運行時配置併發數--> <name>dataproviderthreadcount</name> <value>30</value> </property> </properties> </configuration> </plugin> [...] </plugins><plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <suiteXmlFiles> <!—suite並行運行--><file>src/test/resources/testng1.xml</file> <file>src/test/resources/testng2.xml</file> </suiteXmlFiles> <properties> <property> <name>suitethreadpoolsize</name> <value>2</value> </property> </properties> </configuration> </plugin> [...] </plugins><!--自定義listener 和 reports--> <dependencies> [...] <dependency> <groupId>your-testng-listener-artifact-groupid</groupId> <artifactId>your-testng-listener-artifact-artifactid</artifactId> <version>your-testng-listener-artifact-version</version> <scope>test</scope> </dependency> [...] </dependencies> [...] </plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <properties> <property> <name>usedefaultlisteners</name> <value>false</value> <!-- disabling default listeners is optional --> </property> <property> <name>listener</name> <value>com.mycompany.MyResultListener,com.mycompany.MyAnnotationTransformer,com.mycompany.MyMethodInterceptor</value> </property> <property> <name>reporter</name> <value>listenReport.Reporter</value> </property> </properties> </configuration> </plugin> [...] </plugins><!--用戶能夠自行實現implements org.testng.ITestListener在your-testng-listener-artifact中,可使用scope=test或代碼在/src/test/java中。在當前surefire-testng provider的類載入器中,可使用參數dependenciesToScan參數過濾test artifact 來載入它的類。 testng reporter 也必須實現org.testng.IReporter—>
<plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> [...] <properties> <property> <name>surefire.testng.verbose</name> <value>10</value> </property> </properties> [...] </configuration> </plugin> [...] </plugins> <!--配置日誌等級,區間爲0-10,10爲最詳細。-1時testng爲debug模式。默認爲0—><plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> [...] <properties> <property> <name>objectfactory</name> <value>testng.objectfactory.TestNGCustomObjectFactory</value> </property> </properties> [...] </configuration> </plugin> [...] </plugins> <!--自定義Testng Object Factory:經過實現org.testng.IObjectFactory 和綁定類名到關鍵字:objectfactory--></plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> [...] <properties> <property> <name>testrunfactory</name> <value>testng.testrunnerfactory.TestNGCustomTestRunnerFactory</value> </property> </properties> [...] </configuration> </plugin> [...] </plugins> <!--自定義TestNG TestRunner Factory: 實現org.testng.ITestRunnerFactory, 綁定類名到關鍵字testrunfactory—><plugins> [...] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> [...] <suiteXmlFiles> <file>src/test/resources/suite.xml</file> </suiteXmlFiles> <properties> <property> <name>testnames</name> <value>a-t1,a-t3</value> </property> </properties> [...] </configuration> </plugin> [...] </plugins> <!--只運行指定test name 下的案例,此處只運行test 名稱爲a-t1和a-t3的案例--><argLine>-Djava.endorsed.dirs=...</argLine> <!--指定VM的參數-->
(1) 說明:該插件提供了操做artifact的能力。它可以從本地或遠程庫拷貝、打包artifact到指定位置。
(2) 默認用法:
- pom.xml配置
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>copy</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> </execution> </executions> <configuration> <artifactItems> <artifactItem> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <type>jar</type> <overWrite>false</overWrite> <outputDirectory>${project.build.directory}/alternateLocation</outputDirectory> <destFileName>optional-new-name.jar</destFileName> </artifactItem> </artifactItems> <outputDirectory>${project.build.directory}/wars</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots> </configuration> </plugin> </plugins> </build> [...] </project> <!--在執行mvn package後,junit被拷貝到指定位置—><!--artifact處理順序:當前運行器,本地庫,已配置的遠程庫-->
- 執行命令
- dependency:analyze 分析項目中的依賴,肯定哪些是已使用已聲明、已使用未聲明及未使用已聲明的依賴。
- dependency:analyze-dep-mgt 分析項目中的依賴,並列出已解決依賴的和依賴管理中列出的引入依賴的錯誤匹配。
- dependency:analyze-only 與analyze相同, 但只約束在一個pom 中. 再也不fork進程執行編譯和test-compile。
- dependency:analyze-report 分析項目依賴,生成依賴概述報告,闡明已使用已聲明、已使用未聲明及未使用已聲明的依賴。
- dependency:analyze-duplicate 分析 <dependencies/> and <dependencyManagement/> 標籤,肯定聲明重複的依賴。
- dependency:build-classpath 在本地庫的classpath中使用java –cp,告訴Maven用來輸出的依賴目錄。classpath 文件會被附加到main artifact並一塊兒安裝。
- dependency:copy 獲取在插件管理器中已定義的artifact列表,拷貝他們到一個指定的位置,必要時重命名或去除版本。這個goal可以解決從遠程庫獲取的artifact在本地庫或使用庫中不存在的問題。
- dependency:copy-dependencies 獲取項目直接依賴及可選的傳遞依賴列表,必要時拷貝到指定位置,重命名或去除版本。這個goal能夠從命令行運行。
- dependency:display-ancestors 顯示當前項目的全部POM祖先。當CI中須要瞭解項目的全部POM時很是有用。這個goals能夠從命令行運行。
- dependency:get 解決單獨的artifact, 甚至是來自遠程庫的間接引用的依賴。
- dependency:go-offline 告訴Maven,使用離線模塊,解決項目全部依賴的全部(依賴,插件,報告)
- dependency:list 列出項目的依賴列表
- dependency:list-repositories 顯示全部的項目依賴並列出已使用的。
- dependency:properties 對文件系統中包含artifact的每個項目依賴設置一個property。
- dependency:purge-local-repository 告訴maven 清除非本地庫的依賴artifact文件,並從新解決他們。
- dependency:resolve 告訴maven解決全部的依賴並顯示他們的版本。
- dependency:resolve-plugins 告訴maven解決全部的插件及他們的依賴。
- dependency:sources 告訴maven解決全部的依賴及他們的源碼,顯示他們的版本。
- dependency:tree 顯示樹狀依賴。
- dependency:unpack 與copy相同,但不打包。
- dependency:unpack-dependencies 與copy-dependencies,但不打包。
(3) 擴展配置:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>copy-installed</id> <phase>install</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <version>${project.version}</version> <type>${project.packaging}</type> </artifactItem> </artifactItems> <outputDirectory>some-other-place</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> [...] </project> <!--必須綁定package以後的階段,確保jar包被已生成-->
(1) 說明:該插件容許用戶整合項目的輸出,包括依賴,模塊,網站文檔和其餘文檔到一個單獨的文檔,便可用定製化打包。
建立的文檔格式包括:zip, tar, tar.gz(tgz), gar.bz2(tbgz2), jar, dir,war 等等。四種預約義的描述器可用:bin, jar-with-dependencies, src, project.
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> <id>bin</id> <formats> <format>tar.gz</format> <format>tar.bz2</format> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}</directory> <outputDirectory>/</outputDirectory> <includes> <include>README*</include> <include>LICENSE*</include> <include>NOTICE*</include> </includes> </fileSet> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory>/</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> <fileSet> <directory>${project.build.directory}/site</directory> <outputDirectory>docs</outputDirectory> </fileSet> </fileSets> </assembly><assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> <!-- TODO: a jarjar format would be better --> <id>jar-with-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <outputDirectory>/</outputDirectory> <useProjectArtifact>true</useProjectArtifact> <unpack>true</unpack> <scope>runtime</scope> </dependencySet> </dependencySets> </assembly><assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> <id>src</id> <formats> <format>tar.gz</format> <format>tar.bz2</format> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}</directory> <includes> <include>README*</include> <include>LICENSE*</include> <include>NOTICE*</include> <include>pom.xml</include> </includes> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> <directory>${project.basedir}/src</directory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> </fileSets> </assembly><assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> <id>project</id> <formats> <format>tar.gz</format> <format>tar.bz2</format> <format>zip</format> </formats> <fileSets> <fileSet> <directory>${project.basedir}</directory> <outputDirectory>/</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> <excludes> <exclude>**/*.log</exclude> <exclude>**/${project.build.directory}/**</exclude> </excludes> </fileSet> </fileSets> </assembly>(2) 默認用法
- pom.xml配置
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin><project> [...] <build> [...] <plugins> <plugin> <!-- NOTE: We don't need a groupId specification because the group is org.apache.maven.plugins ...which is assumed by default. --> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> [...] </project><project> [...] <build> [...] <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <configuration> <descriptors> <descriptor>src/assembly/src.xml</descriptor> </descriptors> </configuration> [...] </project>
- 執行命令:
assembly:single(3) 擴展配置:
<project> [...] <build> [...] <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <!-- this is used for inheritance merges --> <phase>package</phase> <!-- bind to the packaging phase --> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> [...] </project><!--自定義組裝描述符--> <?xml version='1.0' encoding='UTF-8'?> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id>demo</id> <formats> <format>jar</format><!--指定打包類型--> </formats> <includeBaseDirectory>false</includeBaseDirectory><!--指定是否包含打包層目錄(好比finalName是output,當值爲true,全部文件被放在output目錄下,不然直接放在包的根目錄下)--> <fileSets><!--指定要包含的文件集,能夠定義多個fileSet--> <fileSet><!--指定要包含的目錄--> <directory>${project.build.directory}/classes</directory><!--指定當前要包含的目錄的目的地--> <outputDirectory>/</outputDirectory> </fileSet> </fileSets> </assembly><!--使用--> <configuration> <finalName>demo</finalName> <descriptors> <descriptor>assemblies/demo.xml</descriptor> </descriptors> <outputDirectory>output</outputDirectory> </configuration>
(1) 說明:該插件提供了在maven中運行ant任務的方式。
(2) 默認用法:
- pom.xml配置
<project> [...] <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> <executions> <execution> <phase> <!-- a lifecycle phase --> </phase> <configuration> <target> <!-- Place any Ant task here. You can add anything you can add between <target> and </target> in a build.xml. --> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> [...] </project>
- 執行命令:
無
(3) 擴展配置:
... <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>package</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo message="make ..."/> <exec dir="src/main/c" executable="make" failonerror="true" /> </tasks> </configuration> </execution> <execution> <id>clean</id> <phase>clean</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo message="make clean ..."/> <exec dir="src/main/c" executable="make" failonerror="true"> <arg line="clean"/> </exec> </tasks> </configuration> </execution> </executions> </plugin> </plugins> </build> ...
(1) 說明:
(2) 默認用法:
- pom.xml配置
<build> <plugins> ... <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.3</version> <executions> ... </executions> <configuration> ... </configuration> </plugin> </plugins> </build><configuration> <!--文本替換--> <file>src/test/resources/a.txt</file> <outputFile>src/main/resources/a.txt</outputFile> <regex>false</regex> <token>{book.name}</token> <value>Thinkin in Java</value> </configuration><!--多個替換--> <configuration> <file>src/test/resources/a.txt</file> <outputFile>src/main/resources/a.txt</outputFile> <regex>false</regex> <replacements> <replacement> <token>{author.name}</token> <value>Bruce Eckel </value> </replacement> <replacement> <token>{book.name}</token> <value>Thinkin in Java </value> </replacement> </replacements> </configuration><!--排除文件--> <configuration> <basedir>${basedir}/src/test/resources</basedir> <includes> <include>**/*.txt</include> </includes> <excludes> <exclude>**/a.txt</exclude> </excludes> <outputBasedir>${basedir}/src/main/resources</outputBasedir> <outputDir>.</outputDir> <regex>false</regex> <preserveDir>false</preserveDir> <tokenValueMap>src/test/resources/book.conf</tokenValueMap> </configuration>
- 執行命令:
無
(3) 擴展配置:
<plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.2</version> <executions> <execution> <phase>generate-test-resources</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <file>src/test/resources/prop.properties</file> <regex>true</regex> <token>BrowserCoreType.*</token> <value>BrowserCoreType=${BrowserCoreType}</value> </configuration> </plugin>