Multi module configuration dependencies support in custom plugin

Hi.

We have our own plugin which is used to integrate with a legacy build system. We are building multi-module, mixing with other languages that may compile Java code using the Gradle java plugin.

We would like to support project lib dependencies as described in chapter 50.7 but we are not quite certain how to add that support.

This particular aspect appears to be undocumented in the plugin guides, would it be possible for you to take the time to explain how this works, what needs to be added etc?

Does it make sense to avoid eg. the compile configuration to avoid clashes with the java plugin?

I don’t understand the question(s). Can you elaborate?

Rather than creating a complicated test case I’ll try to work with the user manual:

In http://www.gradle.org/docs/current/userguide/userguide_single.html#sec:project_jar_dependencies it is described how you would achive “What if one projects needs the jar produced by another project in its compile path? And not just the jar but also the transitive dependencies of this jar?”

In the Example 50.25. Project lib dependencies an example is given that describes how to achieve this for a Java project.

Now, my question is how to implement the same functionality for a language which is not Java, but has the same requirements. We have our own plugin for that, but cannot get this functionality to work because we are presumably missing some functionality to make the Gradle internals handle this correctly.

I have not seen any documentation for this anywhere, can you elaborate here or update the documentation?

The only thing that the ‘java’ plugin adds in this respect is the ‘compile’, ‘runtime’, ‘testCompile’, ‘testRuntime’ configurations. If you add support for another JVM language, you’ll most likely want to build on the ‘java’ plugin (like the ‘groovy’ and ‘scala’ plugins do). Otherwise, you can create your own configurations (see user guide). Apart from that, everything should work the same. (For the providing end, see the explanation of ‘project.artifacts {}’ in the user guide.) It might also help to look at the source code of ‘BasePlugin’ (which you’ll want to use), ‘JavaBasePlugin’, and ‘JavaPlugin’.