首页 > 解决方案 > jmeter-maven-plugin 存储库配置

问题描述

我正在尝试将 JMeter maven 插件与私有 nexus 存储库一起使用,但没有成功。这是POM文件

<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>
    ...
    <repositories>
        <repository>
             <id>KKV nexus</id>
            <url>http://kkv:8082/nexus/repository/maven-group</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>KKV nexus</id>
            <url>http://kkv:8082/nexus/repository/maven-group</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.9.0</version>
                <executions>
                   <!-- 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>
                         <artifacts>nz.co.breakpoint:jmeter-wssecurity:1.6</artifacts>
                    </jmeterExtensions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我在nexus中安装了所有传递依赖项,但构建仍然尝试连接maven central

[INFO] --- jmeter-maven-plugin:2.9.0:configure (configure) @ 0-jarj-testi-liittyma ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] C O N F I G U R I N G    J M E T E R
[INFO] -------------------------------------------------------
[INFO]
[INFO] Building JMeter directory structure...
[INFO] Configuring JMeter artifacts...
[INFO] Populating JMeter directory...
[INFO] Copying extensions to JMeter lib/ext directory C:\Projektit\kkv-e2e-testaus\0-jarj-testi-liittyma\target\jmeter\lib\ext with downloadExtensionDependencies set to true...
Downloading from central: https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.59/bcprov-jdk15on-1.59.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.020 s
[INFO] Finished at: 2019-07-18T13:25:59+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0:configure (configure) on project 0-jarj-testi-liittyma: Failed to collect dependencies at org.apache.wss4j:wss4j-ws-security-dom:jar:2.2.2 -> org.apache.wss4j:wss4j-ws-security-common:jar:2.2.2 -> org.opensaml:opensaml-saml-impl:jar:3.3.0 -> org.opensaml:opensaml-saml-api:jar:3.3.0 -> org.opensaml:opensaml-xmlsec-api:jar:3.3.0 -> org.opensaml:opensaml-security-api:jar:3.3.0 -> org.cryptacular:cryptacular:jar:1.1.1 -> org.bouncycastle:bcprov-jdk15on:jar:1.59: Failed to read artifact descriptor for org.bouncycastle:bcprov-jdk15on:jar:1.59: Could not transfer artifact org.bouncycastle:bcprov-jdk15on:pom:1.59 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

如何配置插件以使用连接?此外,缺少的依赖项很奇怪,bcprov-jdk15on:pom:1.59因为 cryptacular-1.1.1.pom 将依赖项版本定义为 1.54

标签: mavenjmeterdependenciesjmeter-maven-plugin

解决方案


通常,您在settings.xml. 将其用作镜像会将所有请求重定向到它并避免调用 MavenCentral(由于代理/防火墙限制可能会失败)。可以在以下位置找到一个标准示例

https://github.com/sonatype/nexus-book-examples/blob/master/maven/settings/settings.xml

此外请注意,依赖项的版本可能与(某些)poms 中定义的版本不同。您的依赖项中只能有一个版本的依赖项,如果您有多个版本,Maven 会按照各种规则为您选择一个版本。


推荐阅读