运行自由式Maven-Gatling项目时Jenkins作业失败 [英] Jenkins job failure when running a freestyle maven-gatling project

查看:78
本文介绍了运行自由式Maven-Gatling项目时Jenkins作业失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个基于gatling的Maven应用程序;编写了一些操作,方案,并能够使用以下命令在IDE中本地成功运行它们 $mvn gatling:test建立项目并查看任务报告.

I have created a gatling maven based application; wrote some actions, scenario and able to successfully run them locally in IDE using $mvn gatling:test to build project and view the gatling reports.

现在,我正在尝试配置一个jenkins作业以使其自动化,但是在bash脚本中使用相同的命令失败了:

Now I'm trying to have a jenkins job configured to automate this however using the same command in bash script is failing with :

Build step 'Execute shell' marked build as failure
Archiving Gatling reports...
Could not find a Gatling report in results folder.

我的pom.xml与以下内容相同: https ://github.com/gatling/gatling-maven-plugin-demo/blob/master/pom.xml ,但我也尝试添加:

My pom.xml is same as :https://github.com/gatling/gatling-maven-plugin-demo/blob/master/pom.xml except i also tried to add:

<configuration>
 <resultsFolder>/jenkinsworkspace/projectName/target/gatling</resultsFolder>
</configuration>

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>io.gatling</groupId>
  <artifactId>project-id</artifactId>
  <version>3.1.2</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-plugin.version>3.0.1</gatling-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-plugin.version}</version>
      </plugin>
    </plugins>
  </build>

</project>

首先,我需要使用Maven jenkins项目类型而不是自由样式项目吗?

Firstly, Do I need to use a Maven jenkins project type instead of a freestyle project?

第二,根据本地测试,每次执行时,我的加特林报告都会在项目结构的目标文件夹中生成.在我的仓库中,我已经忽略了该文件夹(.gitignore中的文件夹),是因为执行该作业时无法在工作空间中找到它的原因吗?

Secondly, from testing in local my gatling reports are generated in target folder in the project structure on every execution. And in my repo I have ignored this folder (in .gitignore) so is that the reason of not being able to find in workspace when ran the job?

不确定我在执行外壳构建步骤中使用的maven命令是否有问题,或者我的pom.xml是否有问题.

Not sure if its something wrong with either the maven command I'm using in execute shell Build step or is my pom.xml wrong.

从jenkins控制台输出中,似乎下载了pom.xml中提到的所有maven依赖项,但随后导致构建失败. 我是新手,请提供任何建议和帮助.

From jenkins console output, it seems to download all the maven dependencies mentioned in pom.xml but then results in build failure. I'm new to this, kindly provide any suggestions and help.

推荐答案

在jenkins中创建了一个新的自由样式作业,并将Build步骤配置为: 将根POM设置为pom.xml, 在目标和选项gatling:test

Created a new free style job in jenkins and configured the Build step as: put the Root POM as pom.xml , in Goals and options gatling:test

也已启用simulation tracking

这篇关于运行自由式Maven-Gatling项目时Jenkins作业失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆