无法使用 Maven 为 apache jmter 2.13 解析 jars
jars could not be resolved for apache jmter 2.13 with maven
我正在尝试使用 java 代码 运行 jmeter 脚本。我已经做了一个 jmx。当我尝试 运行 显示此错误的代码时,我正在使用 jmeter 2.13。
Failed to execute goal on project JmeterJson: Could not resolve
dependencies for project JmeterJson:JmeterJson:war:0.0.1-SNAPSHOT: The
following artifacts could not be resolved:
commons-math3:commons-math3:jar:3.4.1,
commons-pool2:commons-pool2:jar:2.3: Could not find artifact
commons-math3:commons-math3:jar:3.4.1 in central
(https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR]
我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JmeterJson</groupId>
<artifactId>JmeterJson</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<spring.version>4.0.0.RELEASE</spring.version>
<jdk.version>1.8</jdk.version>
<jackson.version>1.9.10</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>2.13</version>
<exclusions>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>commons-math3</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>commons-pool2</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.4</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
以前,当我没有添加 jmeter jar 时,它工作正常。
2017 年 11 月编辑:
- JMeter Maven Plugin 的最新版本 2.5.1 现在与 JMeter 3.3 兼容,因此最可行的修复方法是升级。
这是由于 JMeter 2.13 pom 中的一个问题,该问题已在夜间构建中修复:
将其添加到 JMeter 依赖项中:
<exclusions>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>commons-math3</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>commons-pool2</groupId>
</exclusion>
</exclusions>
并添加:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.3</version>
</dependency>
我正在尝试使用 java 代码 运行 jmeter 脚本。我已经做了一个 jmx。当我尝试 运行 显示此错误的代码时,我正在使用 jmeter 2.13。
Failed to execute goal on project JmeterJson: Could not resolve dependencies for project JmeterJson:JmeterJson:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: commons-math3:commons-math3:jar:3.4.1, commons-pool2:commons-pool2:jar:2.3: Could not find artifact commons-math3:commons-math3:jar:3.4.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR]
我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JmeterJson</groupId>
<artifactId>JmeterJson</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<spring.version>4.0.0.RELEASE</spring.version>
<jdk.version>1.8</jdk.version>
<jackson.version>1.9.10</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>2.13</version>
<exclusions>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>commons-math3</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>commons-pool2</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.4</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.10.1</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
以前,当我没有添加 jmeter jar 时,它工作正常。
2017 年 11 月编辑:
- JMeter Maven Plugin 的最新版本 2.5.1 现在与 JMeter 3.3 兼容,因此最可行的修复方法是升级。
这是由于 JMeter 2.13 pom 中的一个问题,该问题已在夜间构建中修复:
将其添加到 JMeter 依赖项中:
<exclusions>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>commons-math3</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>commons-pool2</groupId>
</exclusion>
</exclusions>
并添加:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.3</version>
</dependency>