Reputation: 625
I got the following project structure
project
-- build.gradle
-- gradle
| -- java.gradle
| -- artifacts.gradle
In my root build.gradle I wrote
apply from: 'gradle/artifacts.gradle'
In my artifacts.gradle I build an ear and wanted to set the war task (also in artifacts.gradle
) as a deploy dependency with
project(path: ':myWar', configuration: 'myWar')
Now gradle throws me the error Project with path <path> could not be found in root project <project>.
What am I doing wrong?
Upvotes: 5
Views: 12621
Reputation: 3061
Check if the subproject has a settings.gradle
in it (Gradle may define it as the root project)
Delete the .gradle
folder in your project's root folder and resync gradle in your IDE
Check if the project name in settings.gradle
and build.gradle
matches with the folder name, otherwise change the project or directory name
include('subproject')
project(':subproject').projectDir = file('./path_to_/subproject')
:subproject
must be a subfolder of the rootProject named subproject from where the settings.gradle
file resides.Upvotes: 1
Reputation: 1019
In
project(path: ':myWar', configuration: 'myWar')
The :myWar
path must match some of the projects declared in
/settings.gradle
Based on information you provided it seems you have only root project?
Upvotes: 9