英文:
How to use a specific (not default) jar from maven central repo with maven? (hive-exec)
问题
hive-exec
模块恶意使用了一个fatjar来进行maven导入,导致出现了大量的类依赖错误,如guava
、protobuf
、parquet
等。我像这样导入它:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>3.1.2</version>
</dependency>
但我在hive-exec的maven仓库中发现了一个名为hive-exec-3.1.2-core.jar
的jar文件,它只包含自己的类!
是否有一种优雅的方法可以将这个jar文件作为我的Maven依赖导入,而不是默认的fatjar呢?
或者如果它无法访问,那么把那个jar放在那里的意义是什么?
附言:我知道在另一个模块中使用maven-shading可以解决我的问题,但是否实际上有一种方法可以在原地解决这个问题,而不需要创建另一个模块?
英文:
The hive-exec
module evilly use a fatjar for maven import, which causes buckets of class dependency error like guava
, protobuf
, parquet
, etc. I imported it like:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>3.1.2</version>
</dependency>
But i found a jar named hive-exec-3.1.2-core.jar
in hive-exec maven repo, which just contains its own classes!
Is there any elegant way to import this jar file with maven as my dependecy instead of the default fatjar?
Or if it's unreachable, literally what's the meaning of putting that jar there?
P.S. I know maven-shading it in another module can solve my problem, but is there actually a way to solve it in place without create another module.
答案1
得分: 2
你可以这样使用它:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<classifier>core</classifier>
<version>3.1.2</version>
</dependency>
这是否是一个合适的替代品,我无法确定。
英文:
You can use it in this way:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<classifier>core</classifier>
<version>3.1.2</version>
</dependency>
whether this is a proper replacement, I cannot say.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论