简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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