为 Java 寻找合适的 Git 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4193277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:45:30  来源:igfitidea点击:

Looking for decent Git libraries for Java

javagit

提问by corgrath

I am looking for a decent Git library for Java for stand-alone applications.

我正在为独立应用程序寻找一个体面的 Java Git 库。

Can anyone recommend any?

任何人都可以推荐吗?

采纳答案by VonC

I believe you can use JGitin your Java application.

我相信您可以在 Java 应用程序中使用JGit

The main page includes:

主页面包括:

JGit has very few dependencies, making it suitable for embedding in any Java application, whether or not the application is taking advantage of other Eclipse or OSGi technologies.

JGit 的依赖项很少,因此适合嵌入到任何 Java 应用程序中,无论该应用程序是否利用了其他 Eclipse 或 OSGi 技术。

The download pagementions that:

下载页面提到:

JGit can be consumed in a Maven build.
Multiple artifacts are available, depending on the application's requirements:

JGit 可以在 Maven 构建中使用。
有多个工件可用,具体取决于应用程序的要求:

See a full pom.xl in jgit-cookbook/blob/master/pom.xml:

查看完整的 pom.xl jgit-cookbook/blob/master/pom.xml

Extract:

提炼:

<repositories>
    <repository>
      <id>jgit-repository</id>
      <url>http://download.eclipse.org/jgit/maven</url>
    </repository>
  </repositories>

  <!-- Core Library -->
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
      <version>3.4.1.201406201815-r</version>
    </dependency>
  </dependencies>

The exact list of git commands currently supported is not always up-to-date (as the bug 317482 illustrates):

当前支持的 git 命令的确切列表并不总是最新的(如错误 317482 所示):

Update September 2013 - July 2014: all the commands below are now available.

2013 年 9 月 - 2014 年 7 月更新:现在可以使用以下所有命令

alt text

替代文字