Ari*_*lle 80 java dependencies github maven
如何从其GitHub仓库添加Java库(库使用Maven作为构建系统)作为我的Maven项目的依赖?如果不下载和编译库,我可以这样做吗?
And*_*ejs 125
现在,您可以使用JitPack从GitHub存储库导入Java库.在你的pom.xml中:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Run Code Online (Sandbox Code Playgroud)
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo name</artifactId>
<version>Release tag</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
它的工作原理是因为JitPack会检查代码并构建它.所以你最终会下载jar.
如果项目没有GitHub版本,则可以使用提交ID作为版本.
And*_*hev 18
目前,除非图书馆的维护者提供了这样做的方法,否则你无法做到这一点.
因此,在库的标题页上,应该是包含存储库地址的指令,如:
<repositories>
<repository>
<id>YOUR-PROJECT-NAME-mvn-repo</id>
<url>https://raw.github.com/YOUR-USERNAME/YOUR-PROJECT-NAME/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
和依赖名称:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这意味着将在此仓库中搜索项目的所有工件,包括您的依赖项.
您还可以pom.xml查看是否已尝试将工件部署到远程仓库.通常,关键字是oss.sonatype.org或raw.github.com,就像在这种情况下一样.
仅供参考,这是为您的gihub工件提供回购的方法:在github上托管Maven存储库.
您可以按照上述步骤将 Jar 文件正确部署到 github。
| 归档时间: |
|
| 查看次数: |
53128 次 |
| 最近记录: |