英文:
jMeter System Properties from Pom File
问题
我必须使用以下POM文件来设置4个JMeter系统属性:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter-maven-plugin.version}</version>
<configuration>
<skipTests>${skipNFTs}</skipTests>
<generateReports>true</generateReports>
<reportDirectory>${basedir}/target/reports/${performanceTest}</reportDirectory>
<logsDirectory>${basedir}/target/reports/${performanceTest}</logsDirectory>
<jmeterExtensions>
<artifact>org.apache.activemq:activemq-all:jar:5.16.0</artifact>
</jmeterExtensions>
<junitLibraries/>
<propertiesSystem>
<javax.net.ssl.trustStore>${project.build.directory}/target/jmeter/keystore/eskort_keystore.keystore</javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword>P@ssw0rd</javax.net.ssl.trustStorePassword>
<javax.net.ssl.keyStore>${basedir}/target/jmeter/keystore/eskort_keystore.keystore</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>P@ssw0rd</javax.net.ssl.keyStorePassword>
</propertiesSystem>
</configuration>
</plugin>
我获取的输出是:
#Thu Jun 08 17:42:06 EEST 2023 javax.net.ssl.keyStore=C\:\\MyTools\\GitRepo\\Compliance\\performance/target/jmeter/keystore/eskort_keystore.keystore
javax.net.ssl.keyStorePassword=P@ssw0rd
avax.net.ssl.trustStore=C\:\\MyTools\\GitRepo\\Compliance\\performance\\targt/target/jmeter/keystore/eskort_keystore.keystore
javax.net.ssl.trustStorePassword=P@ssw0rd
sun.net.http.allowRestrictedHeaders=true
问题是路径开头的 C\ : 不可用。如何修复它?
英文:
I have to pom file as below to set a 4 JMeter system properties
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter-maven-plugin.version}</version>
<configuration>
<skipTests>${skipNFTs}</skipTests>
<generateReports>true</generateReports>
<reportDirectory>${basedir}/target/reports/${performanceTest}</reportDirectory>
<logsDirectory>${basedir}/target/reports/${performanceTest}</logsDirectory>
<jmeterExtensions>
<artifact>org.apache.activemq:activemq-all:jar:5.16.0</artifact>
</jmeterExtensions>
<junitLibraries/>
<propertiesSystem>
<javax.net.ssl.trustStore>${project.build.directory}/target/jmeter/keystore/eskort_keystore.keystore</javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword>P@ssw0rd</javax.net.ssl.trustStorePassword>
<javax.net.ssl.keyStore>${basedir}/target/jmeter/keystore/eskort_keystore.keystore</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>P@ssw0rd</javax.net.ssl.keyStorePassword>
</propertiesSystem>
</plugin>
the output that i take is :
#Thu Jun 08 17:42:06 EEST 2023 javax.net.ssl.keyStore=C\:\\MyTools\\GitRepo\\Compliance\\performance/target/jmeter/keystore/eskort_keystore.keystore
javax.net.ssl.keyStorePassword=P@ssw0rd
avax.net.ssl.trustStore=C\:\\MyTools\\GitRepo\\Compliance\\performance\\targt/target/jmeter/keystore/eskort_keystore.keystore
javax.net.ssl.trustStorePassword=P@ssw0rd
sun.net.http.allowRestrictedHeaders=true
the problem is is not usable due to the C\ : at the beginning of the path .
how i can fix it ?
答案1
得分: 0
我看到你在混合使用变量:
${project.build.directory} 表示指向你的 "target" 目录的路径。
${basedir} 代表包含 pom.xml 的目录。
所以在系统属性 <javax.net.ssl.trustStore> 中,你多加了一个不必要的 "target"。
你应该检查/审查一下你的目标文件夹中有什么内容,然后相应地设置属性。
注意:
通常,密钥库文件通常具有 .jks 扩展名。
英文:
I see that you are mixing variables:
${project.build.directory} is results in the path to your "target" directory.
${basedir} represents the directory containing pom.xml
so in the system property <javax.net.ssl.trustStore> you are adding an extra "target" that is not needed.
you should check/review what do you have in your target folder and after set the properties accordingly.
Note:
normally a the keystore file usually has a .jks extension.
答案2
得分: 0
如果您的eskort_keystore.keystore
位于与pom.xml相同的文件夹中 - 您应该使用${project.basedir}/eskort_keystore.keystore
。
我不知道您从哪里获得这个"output",但Maven和Java应该能够处理Windows文件路径而不会出现任何问题。
正如您可以在此处看到的,JSR223 Sampler中的Groovy脚本检查了给定路径下密钥库文件的路径和存在性,并成功执行。
更多信息:Maven属性指南。
英文:
If your eskort_keystore.keystore
lives at the same folder where pom.xml - you should use ${project.basedir}/eskort_keystore.keystore
instead.
I don't know where did you get this "output" but Maven and Java should handle Windows file paths without any issues.
As you can see the Groovy script in the JSR223 Sampler checks the path and the presence of the keystore file under the given path and succeeds.
More information: Maven Properties Guide
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论