支持相同依赖项的不同版本

时间:2017-09-29 07:50:19

标签: java maven

我正在开发的框架必须支持同一个库的2个版本。这些版本包含重大变化,但我们不需要这些部分!我们现在想要的是保证这些方法永远不会被意外调用。

e.g。

  • guava 18.0 $subscriptionId="" $tenantid="" $clientid="" $password="" $userPassword = ConvertTo-SecureString -String $password -AsPlainText -Force $userCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $clientid, $userPassword Add-AzureRmAccount -TenantId $tenantid -ServicePrincipal -SubscriptionId $subscriptionId -Credential $userCredential -Environment 'AzureGermanCloud'

  • guava 23.0 HostAndPort.from("127.0.0.1").getHostText()

有没有办法确保在未手动检查每次提交的情况下永远不会为将来的提交调用此类破解方法?

到目前为止我们所做的是,我们在23.0版本中为库提供了一些子模块(foo.a),并添加了在"更高级别"中提供的18.0版本。模块(b)。

模块foo.a

HostAndPort.from("127.0.0.1").getHost()

模块b

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>

这样,如果我们设法获得100%的线路覆盖率,集成测试应该识别任何冲突。但是,单位测试不会,请参阅&#34;提供&#34;引用maven:

  

此范围仅在编译和测试类路径中可用,并且不可传递。

意味着单元测试仍将使用版本18.0

0 个答案:

没有答案