Reputation: 33
I have three gradle projects: 'foo', 'bar' and 'core'. 'foo' and 'bar' need to use the artifactory plugin: 'foo' publishes dependencies needed by 'bar'. The artifactory plugin dependency is defined in 'core' and I need project 'foo' and 'bar' to be able to use it.
Is there a clear way of doing this in gradle 2.12? Project 'core' needs to exist because if the version of the dependencies 'foo' publishes changes I want to update 'core' instead of 'bar', hence avoiding a redeploy of 'bar'
Project foo - build.gradle:
group 'foo'
version '1.0-SNAPSHOT'
apply from: "/path/to/core/artifactory-war.gradle"
apply plugin: 'com.jfrog.artifactory'
Project bar - build.gradle:
group 'foo'
version '1.0-SNAPSHOT'
apply from: "/path/to/core/artifactory.gradle"
apply plugin: 'com.jfrog.artifactory'
Project core - artifactory-war.gradle:
apply from: "/path/to/core/artifactory.gradle"
apply plugin: 'com.jfrog.artifactory'
publishing {
//...
}
Project core - artifactory.gradle:
group 'core'
version '1.0-SNAPSHOT'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0"
}
}
apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
artifactory {
// ...
}
As of now I cannot use the artifactory plugin in project 'foo':
Plugin with id 'com.jfrog.artifactory' not found.
Upvotes: 0
Views: 318
Reputation: 10898
Since Gradle 3.0, this is possible using the improved plugin DSL. The example from the documentations looks like this:
plugins {
id 'my.special.plugin' version '1.0' apply false
}
subprojects {
if (someCondition) {
apply plugin 'my.special.plugin'
}
}
Therefore your case should be:
core
plugins {
id "com.jfrog.artifactory" version "4.4.0"
}
subprojects {
apply plugin "com.jfrog.artifactory"
}
Upvotes: 0