首页 > 解决方案 > 编写加特林脚本时出现“无法解析符号核心”

问题描述

我正在尝试在 Intellij Idea 上创建一个 Gatling 负载测试脚本,而我正处于起步阶段。我用 Maven 创建了一个 Gatling 项目,但我无法导入 io.gatling.core 包。

你能帮我解决我的问题吗?提前致谢。

我的 pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<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>gatling-core</artifactId>
  <version>3.5.1</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <encoding>UTF-8</encoding>

    <gatling.version>3.5.1</gatling.version>
    <gatling-maven-plugin.version>3.1.1</gatling-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-core</artifactId>
      <version>3.5.1</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

我想要达到的目标:

import io.gatling.core.scenario.Simulation
import io.gatling.core.Predef._
import io.gatling.http.Predef._

标签: scalamavengatling

解决方案


或者您应该只使用变量,例如${"ANY_PACKAGE".version}或从终端检查正确的版本。


推荐阅读