我正在烘焙一個在運行時運行Maven任務的Docker鏡像。它看起來有點像這樣:使用Maven下載所有依賴項,插件依賴項,編譯器等?
ADD pom.xml /srv
ADD src /srv/src
WORKDIR /srv
RUN mvn dependencies:go-offline scala:testCompile
在運行時,我跑mvn gatling:execute
運行一個負載測試工具。
我POM看起來是這樣的:
<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
,我不想下載任何依賴關係,我希望他們全部出爐在構建時進入圖像。
但是,即使執行mvn dependencies:go-offline scala:testCompile
也不會讓我一路走到那裏。運行gatling:execute
仍然需要下載更多的依賴關係。
我該如何下載絕對一切 Maven需要到我的Docker鏡像中,以便在運行時不需要下載?
您是否嘗試過將Gatling執行綁定到某個階段,並查看是否存在依賴關係:go-offline將其提取出來? –
你有什麼建議?對不起,漫長的一天,不確定你的意思。 –
喜歡的東西集成測試 執行 –