简体   繁体   English

是否有可以从Hudson / Jenkins获取工件的Ant任务?

[英]Is there an Ant task which can fetch an artifact from Hudson/Jenkins?

I've hand-rolled my project's build-system (mostly in Python + Hudson). 我已经手工推出了我的项目的构建系统(主要是在Python + Hudson中)。 One of the things I need to do quite often is fetch artifacts from upstream Hudson / Jenkins. 我经常需要做的一件事就是从上游Hudson / Jenkins那里获取工件。

These artifacts could be almost anything - for example a zip-file full of business data to process or even an egg containing a load of python code which must be tested. 这些工件几乎可以是任何东西 - 例如一个包含要处理的业务数据的zip文件,甚至包含必须测试的python代码加载的egg。 Almost every important job in our system has upstream dependancies on artifacts produced by other Hudson jobs. 几乎我们系统中的每一项重要工作都有上游依赖于其他Hudson工作所产生的工件。

My manager has suggested that the next iteration of the build-system should replace some of my hand-rolled components with Ant . 我的经理建议构建系统的下一次迭代应该用Ant替换我的一些手动组件。 The purpose of this next iteration will be to reduce the complexity of our systems and bring them into line with the work of other teams who mainly use Java and Ant (and very little Python). 下一次迭代的目的是降低系统的复杂性,使其与主要使用Java和Ant(以及非常少的Python)的其他团队的工作保持一致。

Also I'm personally keen to have an excuse to learn Ant. 我个人也热衷于借口学习Ant。 It seems like a really useful tool. 它似乎是一个非常有用的工具。

So in order not to re-invent the wheel one component I'm definitely going to need is an Ant task which can fetch an artifact from a particular Hudson build. 因此,为了不重新发明轮子,我肯定需要的是一个Ant任务,它可以从特定的Hudson构建中获取工件。 Does such a thing exist. 这样的事情存在吗。 If it does not exist, is there something close to my requirement that I could customize? 如果它不存在,有什么接近我的要求,我可以自定义? I'd rather not re-invent the wheel. 我宁愿不重新发明轮子。


UPDATE1: We have a strong preference for 100% free, open-source tools. 更新1:我们非常喜欢100%免费的开源工具。 Everybody in the team is very happy with Ant, however Maven is something the team is trying to get away from. 团队中的每个人都对Ant非常满意,但是Maven是团队试图摆脱的东西。

正确的解决方案是将工件从Hudson / Jenkins发布到工件管理器,例如NexusArtifactory ,然后使用类似IvyGradle的东西来提取工件版本。

If you must get the dependencies yourself, you could use the get task. 如果您必须自己获取依赖项,则可以使用get任务。 Example: 例:

<get src="http://jenkins/job/project-name/lastSuccessfulBuild/artifact/foo.jar"
     dest="/path/to/local/file"/>

I do, however, agree with Stefan - dependency management is better accomplished by tools mentioned in his answer instead of manually pulling them down yourself using Ant. 但是,我确实同意Stefan的意思 - 依赖管理更好地通过他的答案中提到的工具来完成,而不是使用Ant手动将它们拉下来。

If you are just starting to learn ANT then I would suggest you learn gradle instead, it has the dependency part already integrated and is far easier to work with. 如果你刚开始学习ANT,那么我建议你学习gradle ,它有依赖部分已经集成,并且更容易使用。 Furthermore if you need a specific ANT task you can simply call it from gradle or even import whole ant scripts. 此外,如果您需要特定的ANT任务,您只需从gradle中调用它,甚至可以导入整个ant脚本。

Otherwise I agree with the answer from Stefan Kendall. 否则,我同意Stefan Kendall的回答。

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

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