简体   繁体   English

在子项目中使用重新定位的依赖项

[英]Use relocated dependencies in child projects

Heyho, 嘿嘿

I'm currently developing a bukkit plugin and I want to use guava. 我目前正在开发bukkit插件,并且想使用番石榴。 Bukkit still uses Guava 11.0, but I want to use 14.0. Bukkit仍使用Guava 11.0,但我想使用14.0。 So I tried to relocate guava in my main module. 因此,我尝试在我的主模块中重新放置番石榴。 This worked perfectly. 这工作得很好。 An other module on the same level uses guava too and it needs the "same" guava. 同一级别的另一个模块也使用番石榴,并且需要“相同”的番石榴。 So the guava which is also used in the main project. 因此,番石榴也用于主要项目中。 Of course the imports changed and the main project and the other module are not compatible. 当然,导入内容已更改,并且主项目和其他模块不兼容。

Project structure: 项目结构:

parent: 父母:

  • main module: Uses a relocated version of guava(14.0)# 主模块:使用重新定位的番石榴(14.0)#版本
  • an other module: Uses guava 14.0 but not relocated -> not compatible with the main module 另一个模块:使用guava 14.0但未重新定位->与主模块不兼容

I already tried to relocate guava to the same path in the other module but nothing happens. 我已经尝试过将番石榴重新定位到其他模块中的相同路径,但是什么也没发生。

Maybe anyone has an idea how to fix this. 也许任何人都知道如何解决此问题。 I just need a way to use my relocated guava in my other module :/ 我只需要一种在其他模块中使用重新定位的番石榴的方法:/

Related post: Maven shade relocations accross all modules? 相关文章: 所有模块的Maven阴影重定位?

Have you tried excluding v14 from the the Bukkit dependency? 您是否尝试过从Bukkit依赖项中排除v14? Forgive the naming conventions below. 原谅下面的命名约定。 I did not look up the dependencies in Maven. 我没有在Maven中查找依赖项。

<dependencies>
 <dependency>
  <groupId>Bukkit</groupId>
  <artifactId>Something</artifactId>
  <version>1.0</version>
  <exclusions>
    <exclusion>  <!-- declare the exclusion here -->
      <groupId>Guava</groupId>
      <artifactId>v14</artifactId>
    </exclusion>
  </exclusions> 
 </dependency>
</dependencies>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM