LimitX
LimitX

Reputation: 625

Project with path could not be found in root project

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

Answers (2)

Maicon Mauricio
Maicon Mauricio

Reputation: 3061

Options

  1. Check if the subproject has a settings.gradle in it (Gradle may define it as the root project)

  2. Delete the .gradle folder in your project's root folder and resync gradle in your IDE

  3. 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')
  1. Consider your project's structure: by default :subproject must be a subfolder of the rootProject named subproject from where the settings.gradle file resides.

Upvotes: 1

Martin Linha
Martin Linha

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

Related Questions