[英]Can maven or gradle relocate dependencies on import?
I need a way for maven (or if maven doesn't work gradle) to relocate a dependency when importing it in the <dependencies>
part of my pom.xml我需要一种方法让 maven (或者如果 maven 不工作 gradle)在我的 pom.Z0F635D0E0F3874FFF8B581C137E 的
<dependencies>
部分中导入依赖项时重新定位它
Relocating the dependency when I build my jar doesn't work too well because intellij isn't able to debug the shaded code anymore.在我构建 jar 时重新定位依赖项并不能很好地工作,因为 intellij 无法再调试阴影代码。
I imagine something like this我想象这样的事情
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
<relocatedName>shaded.org.projectlombok</relocatedName>
</dependency>
No, not possible in Maven.不,在 Maven 中不可能。
You can shade a dependency with the Maven shade plugin (this is probably what you meant with "during build"), but you cannot generally shade it.您可以使用 Maven 阴影插件(这可能是“构建期间”的意思)对依赖项进行阴影处理,但通常不能对其进行阴影处理。
The only way I would see would be to build the third-party artifact from source with different project names or to do manipulation in the third-party jar itself and republish it to your (local) repository.我看到的唯一方法是使用不同的项目名称从源代码构建第三方工件,或者在第三方 jar 本身中进行操作并将其重新发布到您的(本地)存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.