欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Maven Ant Plugin in JMeter  

程序员文章站 2022-07-13 21:37:22
...
I have post 2 essay in my blog:

[JMeter Ant build]: http://howtesting.blogspot.com/2013/07/jmeter-ant-build.html
[JMeter Maven Tutorial]: http://howtesting.blogspot.com/2013/07/jmeter-maven-tutorial-version-181.html
Because Document of JMeter is very poor, If you like to make pom.xml, you should read source code of JMeter to understand better to create script.
So I like to use External Ant Script from a Maven Build for a Project.

Executing an External Ant Script from a Maven Build
 
<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>org.apache.maven.plugins</groupId>
  <artifactId>maven-antrun-plugin</artifactId>
  <packaging>pom</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>ant-script-ex</name>
  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipTests>false</skipTests>
</properties>
  <build>
    <plugins>
      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
        <executions>
          <execution>
                                    <id>id.validate</id>
                                    <phase>validate</phase>
       
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>                                 
              <tasks>
             <exec
                  dir="D:/apache-jmeter/jmeter/extras"
                  executable="C:/apache-ant-1.7.1/bin/ant.bat"
                  failonerror="true">
                  <arg line="-Dtest=script run report" />
                                                </exec>
                                   
              </tasks>
                                     
                         <dependencies>
                                                <dependency>
                                                            <groupId>ant-contrib</groupId>
                                                             <artifactId>ant-contrib</artifactId>
                                                             <version>1.0b3</version>
                                                             <exclusions>
                                                               <exclusion>
                                                                         <groupId>ant</groupId>
                                                                         <artifactId>ant</artifactId>
                                                               </exclusion>
                                                             </exclusions>
                                       </dependency>
                                      
                                       <dependency>
                                                            <groupId>org.apache.ant</groupId>
                                                            <artifactId>ant-nodeps</artifactId>
                                                            <version>1.8.1</version>
                                                </dependency>
                                   
                                                <dependency>
                                                            <groupId>org.apache.maven</groupId>
                                                            <artifactId>maven-ant-tasks</artifactId>
                                                            <version>2.1.3</version>
                                                </dependency>
                                               
                                                <dependency>
                                                            <groupId>org.apache.maven.plugins</groupId>
                                                            <artifactId>maven-antrun-plugin</artifactId>
                                                            <version>1.7</version>
                                                </dependency>
                                               
                                    </dependencies>
            </configuration>
                                   
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
 
 

 

 
Command to run pom.xml
Mvn validate


HoaLe