如何在Gradle当前项目中添加其他项目? [英] How to add other projects in current project in Gradle?

查看:61
本文介绍了如何在Gradle当前项目中添加其他项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个项目ProjA和ProjB,这里的ProjB取决于ProjA.那么,如何在ProjB中包含ProjA?而且,如果ProjA build.gradle文件发生更改,请告诉我吗?

I have two projects ProjA and ProjB, here ProjB is depends on ProjA. So, how to include ProjA in ProjB? And please let me know in case change in the ProjA build.gradle file?

推荐答案

如果您的项目位于同一地点,那么您可能会有一个多构建项目.

If your projects are co-located, you could have a multi build project.

假设您有一个包含以下内容的根文件夹:

Say you have a root folder with these contents:

  • 一些根目录
    • 项目-a
      • project-a.gradle
      • src
      • project-b.gradle
      • src

      settings.gradle 包含:

      include 'project-a', 'project-b'
      

      然后

      project-b.gradle 取决于项目A:

      dependencies {
         compile project(':project-a')
      }
      

      此后,项目a将始终在项目b之前进行编译和组装,而项目a的jar文件在编译项目b时将位于类路径上.

      After this, project a will always compile and assemble before project-b and the jar file for project-a jar will be on the classpath when compiling project-b.

      这篇关于如何在Gradle当前项目中添加其他项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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