将人工制品 SLF4J 包含在使用包含 maria-db connect 的 jmeter 插件的 Maven 项目中时找不到人工制品 SLF4J
Failure to find artefact SLF4J when including it in a maven project that uses jmeter plugin with maria-db connect included
jmx 文件使用 JSR223 示例来 运行 一些 selenium 代码,在某些时候它需要连接到 maria 数据库以获取代码。
pom:
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>kp-load-test</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterExtensions>
<artifact>com.codeborne:selenide:5.7.0</artifact>
<artifact>org.mariadb.jdbc:mariadb-java-client:2.4.0</artifact>
</jmeterExtensions>
</configuration>
</plugin>
</plugins>
</build>
运行 以下命令:mvn clean verify 抛出以下错误
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:3.1.0:configure (configuration) on project kp-load-test: Failure to find org.slf4j:slf4j-api:jar:[1.4.0,1.7.25] in https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced -> [Help 1]
如果我评论来自 jmeterExtensions 的 mariadb 工件,代码 selenium 代码将 运行 并在到达 jdbc 部分时抛出驱动程序异常。
查看 mariadb jar,我发现 pom 包含以下内容:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>[1.4.0,1.7.25]</version>
<optional>true</optional>
</dependency>
如何在不产生该错误的情况下传递 mariadb 人工制品?
必须添加
<downloadExtensionDependencies>false</downloadExtensionDependencies>
之后我将脚本所需的每个库添加到 运行
jmx 文件使用 JSR223 示例来 运行 一些 selenium 代码,在某些时候它需要连接到 maria 数据库以获取代码。
pom:
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>kp-load-test</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Generate JMeter configuration -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterExtensions>
<artifact>com.codeborne:selenide:5.7.0</artifact>
<artifact>org.mariadb.jdbc:mariadb-java-client:2.4.0</artifact>
</jmeterExtensions>
</configuration>
</plugin>
</plugins>
</build>
运行 以下命令:mvn clean verify 抛出以下错误
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:3.1.0:configure (configuration) on project kp-load-test: Failure to find org.slf4j:slf4j-api:jar:[1.4.0,1.7.25] in https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced -> [Help 1]
如果我评论来自 jmeterExtensions 的 mariadb 工件,代码 selenium 代码将 运行 并在到达 jdbc 部分时抛出驱动程序异常。
查看 mariadb jar,我发现 pom 包含以下内容:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>[1.4.0,1.7.25]</version>
<optional>true</optional>
</dependency>
如何在不产生该错误的情况下传递 mariadb 人工制品?
必须添加
<downloadExtensionDependencies>false</downloadExtensionDependencies>
之后我将脚本所需的每个库添加到 运行