superM
superM

Reputation: 8695

Gradle build fails

I have two Gradle projects, A and B. B is a simple Java application and is consumed by A as a compile project dependency. A is a web application.

Both A and B apply the java plugin, A applies the war plugin as well.

When building A, I get the following error:

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':war'.
> Configuration with name 'default' not found.

When separately building B I get no errors. When building from root, I get no errors either. The issue shows up only when building A.

I've also tried copying the B.jar to the lib folder of A and setting a dependency:

compile files("lib/B.jar")

The build in this case works fine.

What configurations do I need to include to avoid the error?

Upvotes: 4

Views: 11870

Answers (1)

Stanislav
Stanislav

Reputation: 28126

It's possible, when one subproject doesn't see another, if settings.gradle file is not on the parent directory for both subprojects and the subprojects in it are included via includeFlat. In this case you can call any task from your parent projects and all subprojects will know about each other, but it'll be unable to build separate subproject.

Any way, you need to show your project structure and build/settings files as well, to find out the problem.

Upvotes: 1

Related Questions