使用单一源代码树的普通Java和Android Gradle项目 [英] Gradle project for plain Java and Android with single source tree

查看:132
本文介绍了使用单一源代码树的普通Java和Android Gradle项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行包含普通Java(Swing UI)和Android部件的项目,基本上由三部分组成的源代码树:

  | ---摆动(30%的代码)
|
src ----- | ---普通(40%的代码)
|
| --- android(30%的代码)

我应该如何定义gradle项目(s)为了从相同的来源构建2个不同的应用程序 - 一个用于Java / Swing另一个用于Android?



我尝试了不同的方法,但最终失败了。 ..
$ b

更新



如果某人考虑使用2个或更多项目独立的源代码树 - 实现它没有问题 - 有很多例子。

或者,如果使用相同的编译器考虑具有相同源代码树的2个项目,它又可以与Gradle一起使用。



问题在于在相同的源代码树上使用不同的编译器的gradle项目。

安装3个模块并通过settings.gradle文件按照需要导入这些模块。有关详情,请参阅 https://docs.gradle.org/current/userguide/multi_project_builds.html


I'm running project which includes both plain Java (Swing UI) and Android parts, basically source tree consisting 3 parts:

         |---swing  (30% of code)
         |
 src-----|---common (40% of code)
         |
         |---android (30% of code)

How should I define gradle project(s) in order to build from the same sources 2 different apps - one for Java/Swing another one for Android?

I tried different approaches but in the end failed...

Update

If one'd consider 2 or more projects with independent source trees - no problem to implement it - there're number of examples.

Or if to consider 2 projects with the same source tree using the same compiler, again it works with Gradle.

Problem is in implementing gradle project utilizing different compilers on the same source tree.

解决方案

Setup 3 modules and import these modules as you want via the settings.gradle files. For more details see https://docs.gradle.org/current/userguide/multi_project_builds.html

这篇关于使用单一源代码树的普通Java和Android Gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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