Gradle + Buildship - 切换JAR和项目之间的依赖关系 [英] Gradle + Buildship - Switch dependency between JAR and projects

查看:171
本文介绍了Gradle + Buildship - 切换JAR和项目之间的依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照我想要的方式配置Build Build for Eclipse的麻烦。我目前在Eclipse中总共有50多个项目,但是我想转到仅在Eclipse中积极开展的项目,其他项目将使用Maven存储库来解决依赖关系。

I'm having some trouble configuring Buildship for Eclipse the way I want. I currently have > 50 projects always open in Eclipse, but I want to move to having only the projects I am actively working on in Eclipse, and the other projects would use a Maven repository to resolve their dependency.

让我们说ProjectA(它包含一个主)取决于ProjectB(一个库项目)。如果ProjectB在Eclipse中打开,我希望ProjectA直接使用ProjectB。在运行ProjectA时,ProjectB中代码的更改将会显着。但是,如果ProjectB关闭,我希望ProjectA使用位于build.gradle文件中提到的Maven存储库中的ProjectB的JAR。

Lets say ProjectA (which contains a main) depends on ProjectB (a library project). If ProjectB is opened in Eclipse, I would like ProjectA to use ProjectB directly. A change in the code in ProjectB would be noticeable when running ProjectA. However, if ProjectB is closed, I would like ProjectA to use the ProjectB's JAR located in the Maven repository mentioned in the build.gradle file.

我所说的行为about是详细的 here

The behavior that I am talking about is detailed here.

有没有办法使用Buildship?还是应该使用另一个Gradle Eclipse插件?

Is there a way to do that using Buildship? Or should I use another Gradle Eclipse plugin?

推荐答案


  1. 有一个新的复合构建支持功能添加在Gradle 3.1中。这个功能是一个改变游戏规则的操作,简单易用,可以同时处理多个项目。

  1. There's a new composite build support feature added in Gradle 3.1. This feature is a game changer and makes it simple to work on more than one project at once.

您可以使用依赖替代规则以交换与本地项目依赖关系的存储库依赖关系。

You can use dependency substitution rules to swap out repository dependencies with local project dependencies.

如果每个项目都在自己独立的git / subversion版本库中,您可以使用 prezi自豪的来管理项目的骄傲。您可以将(动态生成的)多模块构建导入到构建中。

If each project is within it's own separate git/subversion repository you can use prezi pride to manage the 'pride' of projects. You could import the (dynamically generated) multi module build into buildship.

如果要使用 eclipse插件,而不是构建您使用 whenMerged withXml 钩子来调整生成的 .classpath 文件以指向工作区内的项目(注意eclipse现在将以渐变命令行的方式不同) 。

If you wanted to use the eclipse plugin instead of buildship you use the whenMerged or withXml hooks to tweak the generated .classpath files to point to the projects within your workspace (note eclipse will now build differently to gradle command line).

这篇关于Gradle + Buildship - 切换JAR和项目之间的依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆