Rafael Paz
Rafael Paz

Reputation: 537

Gradle NOT finding my subdirectory to build

I have an application with subdirectory(projects) inside this project like this

etc...

I'm trying to build Project b from the root folder (My Application) using this command:

gradle :Project b:build

But I got this error message:

* What went wrong:
Project 'Project b' not found in root project 'MyApplication'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

But if from My Application I do this using command line:

cd Project b 

and then run the build

gradle build

It builds successfully. What am I doing wrong?

Upvotes: 1

Views: 1816

Answers (2)

Michael Easter
Michael Easter

Reputation: 24468

I'm assuming that there is no settings.gradle and that this is not a multi-project build. Using that would be better but given the original question, note that -p specifies the starting project for Gradle.

So in the MyApplication dir, consider:

gradle -p "Project b" build

Though it would be wise to (a) investigate multi-project builds (b) remove spaces from the path (as mentioned in a comment).

Upvotes: 3

Rafael Paz
Rafael Paz

Reputation: 537

I found a way of doing the building from the root to subdirectories. In case anyone needs it, this is what I did on the terminal:

cd MyApplication/Project b && gradle build

Upvotes: 0

Related Questions