Hi,
I am trying to figure out how to have a child project use a plugin created from a peer child project. In my setup, the ‘tools’ project creates a jar with a gradle plugin. The idea is that the ‘framework’ project will then use this plugin to generate classes from template files. The problem is that when attempting to build the ‘tools’ project gradle configures the ‘framework’ project. The framework project then attempts to apply the plugin that has yet to be built from the ‘tools’ project and fails.
I am using Gradle 1.11.
Directory Structure: framework/ gradle/ (common scripts) tools/
The tools jar will end up looking like this: com/… config/… META-INF/MANIFEST.MF META-INF/gradle-plugins/rof-tools.properties (name of plugin is rof-tools)
Relevant Files:
rof-tools.properties:
implementation-class=com.my.org.rof.tools.gradle.ROFToolsPlugin
framework/build.gradle:
evaluationDependsOn(':tools')
buildscript {
dependencies {
classpath fileTree(dir: "${projectDir}/../tools/build/libs", include: '*.jar')
}
}
apply plugin: 'rof-tools'
tools/build.gradle:
apply plugin: 'groovy'
/build.gradle
buildscript {
apply from: "${projectDir}/gradle/buildscript.gradle"
}
allprojects {
apply plugin: 'idea'
apply plugin: 'project-report'
apply plugin: 'build-dashboard'
}
subprojects {
buildscript {
def projectBuildScriptFile = new File("${projectDir}/gradle/buildscript.gradle");
if (projectBuildScriptFile.exists())
{
apply from: projectBuildScriptFile.getAbsolutePath()
}
}
apply plugin: 'project-report'
apply plugin: 'build-dashboard'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'artifactory'
archivesBaseName = projectName
version = hasProperty('publishVersion') ? publishVersion : projectVersion
group = projectGroup
// configure the common properties
apply from: "${rootDir}/gradle/common-properties.gradle"
// configure the repositories
apply from: "${rootDir}/gradle/repositories.gradle"
// configure the dependencies
def projectDependenciesFile = new File("${projectDir}/gradle/dependencies.gradle")
if (projectDependenciesFile.exists())
{
apply from: projectDependenciesFile.getAbsolutePath()
}
// configure artifactory
apply from:
"${rootDir}/gradle/artifactory.gradle"
// common gradle tasks
apply from: "${rootDir}/gradle/common.gradle"
// configure integration tests
apply from: "${rootDir}/gradle/integration.gradle"
jar {
manifest {
attributes("Implementation-Title": projectName, "Implementation-Version": version)
}
}
}
There are more configuration files but I do not believe they are relevant for this.
Thanks, Mark