Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Maven下载所有依赖项、插件依赖项、编译器等?_Maven_Docker_Gatling - Fatal编程技术网

使用Maven下载所有依赖项、插件依赖项、编译器等?

使用Maven下载所有依赖项、插件依赖项、编译器等?,maven,docker,gatling,Maven,Docker,Gatling,我正在烘焙一个Docker映像,它在运行时运行一个Maven任务。看起来有点像这样: ADD pom.xml /srv ADD src /srv/src WORKDIR /srv RUN mvn dependencies:go-offline scala:testCompile <project> <dependencies> <dependency> <groupId>io.gatling</

我正在烘焙一个Docker映像,它在运行时运行一个Maven任务。看起来有点像这样:

ADD pom.xml /srv
ADD src /srv/src

WORKDIR /srv
RUN mvn dependencies:go-offline scala:testCompile
<project>
  <dependencies>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-core</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-http</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-app</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling.highcharts</groupId>
            <artifactId>gatling-charts-highcharts</artifactId>
            <version>${gatling.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>io.gatling</groupId>
                <artifactId>gatling-maven-plugin</artifactId>
                <version>${gatling-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
在运行时,我运行
mvn gatling:execute
来运行负载测试实用程序

我的POM如下所示:

ADD pom.xml /srv
ADD src /srv/src

WORKDIR /srv
RUN mvn dependencies:go-offline scala:testCompile
<project>
  <dependencies>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-core</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-http</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-app</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling.highcharts</groupId>
            <artifactId>gatling-charts-highcharts</artifactId>
            <version>${gatling.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>io.gatling</groupId>
                <artifactId>gatling-maven-plugin</artifactId>
                <version>${gatling-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

加特林
加特林磁芯
${gatling.version}
加特林
加特林http
${gatling.version}
加特林
加特林应用程序
${gatling.version}
伊奥·加特林·海图
加特林海图
${gatling.version}
测试
net.alchim31.maven
scala maven插件
${scala maven plugin.version}
加特林
gatlingmaven插件
${gatling plugin.version}
执行
我想要实现的是,当我最终运行
mvn gatling:execute
时,我不想下载任何依赖项,我希望它们在构建时都烘焙到映像中

然而,即使执行
mvn依赖项:离线scala:testCompile
,我也无法完全做到这一点。运行
gatling:execute
仍然需要下载更多依赖项


我如何将Maven所需的一切绝对下载到Docker映像中,这样就不需要在运行时下载了

您不必使用maven插件运行模拟,是吗?您可以使用maven打包一个包含所有依赖项的jar,并从中执行gatling runner

您可以使用以下命令下载所有依赖项:
mvn dependency:copy dependencies


在此之后,所有项目的依赖项都将在/target/dependency/文件夹中可用。

您是否尝试过将Gatling执行绑定到一个阶段,并查看dependencies:go offline是否会将其选中?您有何建议?很抱歉,漫长的一天,我不知道你到底是什么意思。类似于集成测试执行的问题是,如果不大规模地禁用端点,我无法运行
gatling:execute
)这是可以理解的,但如果你不经过mvn包阶段,这不是一个问题。不管怎样,maven依赖插件是否找到了绑定到某个阶段的Gatling依赖项?我知道。我需要一些快速的东西,我不想整天忙于maven汇编插件,试图将Scala应用程序打包并正常运行。