I have a set of plugins that I would like to use in several projects, including subprojects of the project that currently contains them.
Originally they were built like a standard project ‘:plugins’ and had other projects load it from a known location using
buildscript { dependencies { classpath files(url) } }
. I then wanted to use the plugins from another subproject ‘:xyz’ of the same project containing ‘:plugins’, but I found that I could not get my plugins to build before they were used by ‘:xyz’ using
buildscript { dependencies { classpath project(':plugins') } }
on the root project. I then tried to move ‘:plugins’ into ‘:buildSrc’ to have them built first for the entire project. As I can’t address ‘:buildSrc’ from the project code, I thought I would have the buildSrc build assemble the jar for me, but the jar I create comes out empty.
apply plugin: 'groovy'
dependencies {
compile gradleApi()
compile localGroovy()
}
jar {
archiveName = 'plugins.jar'
from sourceSets.main.output
manifest {
attributes 'Implementation-Title': 'my.helicopter.plugins'
}
}
defaultTasks 'assemble'
What is the build of buildSrc doing differently from a regular Groovy project build that prevents this from working?