-1
如何将Jar文件作为使用IntelliJ和Maven的依赖项使用?我有一些包含API代码的jar,但是当我把它们放在我的外部库中时,它会给出错误提示它缺失。使用Jar作为intelliJ/Maven依赖关系
如何将Jar文件作为使用IntelliJ和Maven的依赖项使用?我有一些包含API代码的jar,但是当我把它们放在我的外部库中时,它会给出错误提示它缺失。使用Jar作为intelliJ/Maven依赖关系
最简单的方法来做到这一点是通过安装在你的本地仓库的jar文件,如JB Nizet已经提到:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
参见How to add local jar files in maven project?
这工作得很好,只要你是只使用你的本地Maven仓库。但是,当其他人应该能够建立你的项目时,他们会遇到同样的问题。所以这里最简单的方法是在代理Maven仓库中安装jar文件,如果你有一个(许多公司)。
你也可以参考jar文件作为系统的依赖:
<dependency>
<artifactId>..</artifactId>
<groupId>..</groupId>
<scope>system</scope>
<systemPath>${basedir}/lib/dependency.jar</systemPath>
</dependency>
还有一个非常不错的选择:Maven: add a dependency to a jar by relative path
https://maven.apache.org/guides/mini/guide - 第三党 - 罐子,local.html –