Java 如何从github项目创建一个jar文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20172235/
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
How to Create a jar file from github project
提问by nothing
I want a jar file for the project https://github.com/klout/brickhouse
but I don't see any link on the site which gives me jar file. There is a link on right menu to download the project as zip file.
我想要一个项目的 jar 文件,https://github.com/klout/brickhouse
但我在网站上没有看到任何给我 jar 文件的链接。右侧菜单中有一个链接可以将项目下载为 zip 文件。
I found similar question How to create single jar file from github tree?, but I have dependencies in the pom.xml. I'm using eclipse and win-7. One way I can think of is create a new project in eclipse, add all java packages and files, get all dependency jar files from pom.xml, download them and add to class path. But this will be a lengthy process. Any help is much appreciated. Thanks.
我发现了类似的问题How to create single jar file from github tree? ,但我在 pom.xml 中有依赖项。我正在使用 eclipse 和 win-7。我能想到的一种方法是在 eclipse 中创建一个新项目,添加所有 java 包和文件,从 pom.xml 获取所有依赖 jar 文件,下载它们并添加到类路径。但这将是一个漫长的过程。任何帮助深表感谢。谢谢。
采纳答案by Jerome Banks
A little late in responding, but Brickhouse has a separate Downloads page in the wiki
回复有点晚,但 Brickhouse 在 wiki 中有一个单独的下载页面
https://github.com/klout/brickhouse/wiki/Downloads
https://github.com/klout/brickhouse/wiki/Downloads
Also, if you are using maven or ivy, it should be available in the sonatype public repo. http://central.maven.org/maven2/com/klout/brickhouse/
此外,如果您使用的是 maven 或 ivy,它应该在 sonatype 公共存储库中可用。 http://central.maven.org/maven2/com/klout/brickhouse/
If you are using maven to build a jar assembly, add the following lines in your pom.xml
如果您使用 maven 构建 jar 程序集,请在 pom.xml 中添加以下行
<dependency>
<groupId>com.klout</groupId>
<artifactId>brickhouse</artifactId>
<version>0.5.5</version>
</dependency>
回答by juan.facorro
There's a Getting Startedsection in the project's README that shows the steps to follow to do just that. I just tried them and they work just fine:
项目的 README 中有一个“入门”部分,其中显示了执行此操作的步骤。我刚刚尝试过它们,它们工作得很好:
$ git clone http://github.com/klout/brickhouse
$ cd brickhouse
$ mvn package
$ cd target
$ dir
That's it! You have to have Maven installed of course.
就是这样!当然,您必须安装 Maven。