简体   繁体   English

从Eclipse的更深层文件夹执行Gradle构建

[英]Execute Gradle build from deeper folder in Eclipse

I am trying to execute a gradle build in a subdirectory but it doesn't go any lower than the root build.gradle 我正在尝试在子目录中执行gradle构建,但不会低于根build.gradle

To illustrate, I have a root project folder, as well as the following 为了说明这一点,我有一个根project文件夹,以及以下内容

project
project/build.gradle
project/api
project/api/build.gradle
project/api/src
project/core
project/core/build.gradle
project/core/src

When I click run the project/api/build.gradle file, it will build the files, underneath the project directory, like 当我单击运行project/api/build.gradle文件时,它将在project目录下构建文件,例如

project/api/src/package/Class.java
project/target/classes/package/Class.class

What I want is to separate the built classes into each subfolder. 我想要的是将构建的类分为每个子文件夹。

project/api/src/package/Class.java
project/api/target/classes/package/Class.class

Is there a way to specify in eclipse to use the sub folder as the project folder? 有没有一种方法可以在eclipse中指定将子文件夹用作项目文件夹? I can run gradle either by cd ing into the directory, or using the -p argument on the command line, but can't seem to find a way to do this with eclipse. 我可以通过cd进入目录或在命令行中使用-p参数来运行gradle,但似乎找不到用Eclipse做到这一点的方法。

The only thing that I haven't tried yet, is to have a task buildApi and buildCore in the project/build.gradle file and then set the output folder there. 我还没有尝试过的唯一事情是在project/build.gradle文件中有一个任务buildApibuildCore ,然后在那儿设置输出文件夹。

如果您有多个Gradle构建文件,则需要设置多项目构建

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

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