简体   繁体   English

Gradle / Jenkins JAR发布到GitHub

[英]Gradle / Jenkins JAR Release to GitHub

I am working on a bunch of projects which are all part of a larger project (pipeline) and thus need to be tested together quite often. 我正在从事大量项目,这些项目都是较大项目(管道)的一部分,因此需要经常进行测试。 Manual tests are not as great as they should be, so I decided to run things in the future using Gradle + Jenkins CI. 手动测试没有达到应有的效果,因此我决定将来使用Gradle + Jenkins CI进行测试。 My first tests were successfuly, unit tests etc are running great and Jenkins builds my JAR files that I want to deploy quite nicely. 我的第一个测试成功完成,单元测试等运行良好,Jenkins构建了我想要很好地部署的JAR文件。

Since all my projects are open source and available on GitHub, I'd love to set things up to be published on the GitHub releases page of the respective (sub-) project, eg something like this: 因为我所有的项目都是开源的,并且可以在GitHub上使用,所以我很乐意将其设置为在相应的(子)项目的GitHub版本页面上发布,例如:

  • I develop, commit with a Git tag 我开发并提交一个Git标签
  • Jenkins sees this via a Hook, runs the Gradle Script to build things and upon successful tests publishes the JAR file created in my project to a new release version on GitHub Jenkins通过一个Hook看到了这一点,运行Gradle Script进行构建,并在成功测试后将在我的项目中创建的JAR文件发布到GitHub上的新发行版。

Unfortunately, this is not working quite as expected, eg using the Plugin here , which for example only pushed the packaged source code and not the JAR file. 不幸的是,这不能按预期工作,例如,使用此处Plugin ,例如仅推送打包的源代码,而不推送JAR文件。 Otherwise this works well and I might just have overseen something? 否则,这会很好,我可能只是监督了一些事情?

Does someone have experience on this ? 有人对此有经验吗?

I think you are mistaking what a Github release is. 我认为您误解了Github版本 From a Github point of view, a release is not some folder where you would deploy your arfifact (eg your built Jar) but is basically just a Git tag that points to a certain commit and says "ok, I consider this commit d215465454 to be my release 1.2.3". 从Github的角度来看,发行版不是用于部署arfifact的某个文件夹(例如,您构建的Jar),而基本上只是指向某个提交并表示“好的,我认为此提交d215465454的Git标签”我的版本1.2.3”。 It is just a pointer to a commit so you can always find the Git history for any specific "release". 它只是一个提交的指针,因此您始终可以找到任何特定“发行版”的Git历史记录。 Please see Git excellent Tagging documentation for more information. 请参阅Git出色的标记文档以获取更多信息。

Moreover, you probably shouldn't need to expose the actual jar to your end users. 而且,您可能不需要向最终用户展示实际的jar。 Instead you could rely on Bintray or Artifactory to deploy your actual jar artifact and your end users could configure their gradle build file to depend on your jar. 相反,您可以依靠Bintray或Artifactory部署实际的jar工件,最终用户可以配置gradle构建文件以依赖于jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM