I’m trying to experimentally port build system for my library from MAVEN to gradle. Library contains multiple projects:
API.jar
IMPL.jar
MAVEN plugin to custom-compile resource coming with applications using my lib. Compiler comes in IMPL.jar, plugin just invokes it at build time. IMPL jar is not aware about gradle and gradle plugin and internally uses commons-io:2.4
I just see no sufficient way to refer plugin from another sub-module. Here is what i’ve done, hopefully there is some other way, because with these lines in build.gradle
* What went wrong:
A problem occurred configuring project ':my-app'.
> Could not resolve all dependencies for configuration ':my-app:classpath'.
> Could not find my-test:my-gradle-plugin:.
Searched in the following locations:
file:/C:/Temp/my-test/my-gradle-plugin/build/libs/my-gradle-plugin-.jar
file:/C:/Temp/my-test/my-gradle-plugin/build/libs/my-gradle-plugin.jar
Required by:
my-test:my-app:unspecified
Problem does not appear if I build plugin beforehand, i.e. my-gradle-plugin.jar is available in ‘libs’ folder before I launch ‘gradle build’.
Note: i have to have plugin as separate module and be publishable to repository because it will be used in external builds too.
I’m new to Gradle and I ran into a similar problem recently. If I understand correctly, it’s the chicken-egg problem. The overall build has to understand all build.gradle files to run the build. But one of the applied plugins is not present at that time, which is expected to be created by the same build; so the chicken-egg case.
I would say - yes it is exactly it, “the chicken-egg problem”, unless gradle is able to deffer evaluation of model of sub-set of child projects using ‘local’ plugin until it is compiled. Unfortunately I was unable to find such possibility in gradle so far.