如何在测试执行过程中更改依赖关系的版本以测试与Maven的二进制兼容性?
我目前正在研究DBunit扩展库。因此,该库取决于dbunit。
我将版本提取为Maven属性。
<properties>
<dbunit.version>2.4.8</dbunit.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>${dbunit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
这使我可以使用另一个dbunit版本运行maven构建
mvn test -Ddbunit.version=2.7.3
,但它也更改了编译器使用的dbunit版本。因此,我测试源代码兼容性与另一个dbunit版本。
我想通过Maven构建回答的问题是:
如果我使用与DBUNIT 2.4.8一起使用DBUNIT 2.7.3在运行时使用的库,我的库工作正常吗?
我想介绍版本范围,以便库的客户端可以选择他们要使用的版本,但是为此,我想测试哪些版本可行。
maven-surefire-plugin
允许我添加其他类路径。但是,只有我知道自由的道路。我想使用GAV(组伪像版)格式。
我该如何解决?您知道另一个可以处理此类情况的插件吗?
I'm currently working on a dbunit extension library. Thus this library depends on dbunit.
I extracted the version as a maven property.
<properties>
<dbunit.version>2.4.8</dbunit.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>${dbunit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
This allows me to run the maven build with another dbunit version
mvn test -Ddbunit.version=2.7.3
But it also change the dbunit version that the compiler uses. Thus I test source code compatibility to another dbunit version.
The question I want to answer with my maven build is:
Does my library work normal, as specified by the tests, if I use the library that was build against dbunit 2.4.8 with dbunit 2.7.3 at runtime?
I would like to introduce version ranges so that clients of the library can choose which version they want to use, but to do that I want to test which versions work.
The maven-surefire-plugin
allows me to add additional classpath entries. But only if I know the path of a lib. I would like to use the GAV (group artifact version) format.
How can I solve this? Do you know another plugin that can handle such cases.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论