我正在使用Maven 集成測驗框架插件來測驗定制開發插件的一個目標。就測驗而言,一切正常。但是,我注意到了一個意想不到且不受歡迎的技術性:
為單個測驗用例創建的本地存盤庫target/maven-it/.../test-case/.m2/repository總是從Maven 中央存盤庫遠程填充。如果我在mvn clean integration-test未連接到 Internet 的情況下運行,則依賴關系決議會在連接嘗試失敗后導致錯誤。但是,我希望它在位于USER/.m2/repository第一個的“標準”快取中查找依賴項,在我的實驗中已經存在依賴項。
有趣的是,即使在添加--offline選項后mvn clean integration-test,仍然會嘗試在線依賴決議。
我的主要問題是——這應該發生嗎?這是使用 Maven 集成測驗框架時的預期行為嗎?還是您認為我使用它的方式可能有問題?
pom.xml來自測驗的自定義開發插件的相關依賴項:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.16.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-jupiter-extension</artifactId>
<version>0.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-assertj</artifactId>
<version>0.11.0</version>
<scope>test</scope>
</dependency>
相關插件:
<plugin>
<groupId>com.soebes.itf.jupiter.extension</groupId>
<artifactId>itf-maven-plugin</artifactId>
<version>0.11.0</version>
<executions>
<execution>
<id>installing</id>
<phase>pre-integration-test</phase>
<goals>
<goal>install</goal>
<goal>resources-its</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<systemProperties>
<maven.version>${maven.version}</maven.version>
<maven.home>${maven.home}</maven.home>
</systemProperties>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
uj5u.com熱心網友回復:
如果從用戶本地快取中消耗依賴項,$HOME/.m2/repository則可能會發生已經在本地快取中的部分影響集成測驗。這就是每個集成測驗彼此完全分離的原因之一。
此外,它可以以更簡單的方式并行化集成測驗。
此外,您可以將自己的配置配置settings.xml為使用存盤庫中的任何依賴項,而不是直接從中心使用,這也意味著集成測驗將從該存盤庫中使用它們的依賴項。
除此之外,使用用戶本地快取將無法(或至少更復雜)創建具有預定義狀態(這意味著已經存在的工件)的本地快取來測驗特定場景。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/413775.html
標籤:
