I am new to gradle (leaving from maven). Now I have a problem. I have a gradle build where I want to use the com.bmuschko.nexus
plugin. But my project depends on another project where I also want to use the com.bmuschko.nexus
plugin.
So when I build I get an Exception:
Plugin 'com.bmuschko.nexus' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add "apply plugin: 'com.bmuschko.nexus'" to the body of the script to use the plugin.
But when I do so -> Add apply plugin: 'com.bmuschko.nexus'
to the body of the script to use the plugin I get another exception:
> Failed to apply plugin [id 'com.bmuschko.nexus']
> Plugin with id 'com.bmuschko.nexus' not found.
How can I solve this?
settings.gradle
include ':config'
project(':config').projectDir = new File(settingsDir, '../zConfig')
build.gradle
plugins {
// id "com.bmuschko.nexus" version "2.3" // already in classpath
id "me.champeau.gradle.antlr4" version "0.1"
}
apply plugin: 'java'
apply plugin: 'maven'
//apply plugin: 'com.bmuschko.nexus'
dependencies {
compile project(':config')
}
EDIT: to reproduce just clone the repo https://github.com/KIC/stackoverflow/tree/master/gradleproblem and try gradle tasks
in the bar directory
EDIT2: Seems that I could solve the nexus upload problem by omitting the plugin and follow this answer https://stackoverflow.com/a/16766946/1298461
But since I have also an antlr project and a second antlr project extending the grammar of the first, I have the very same problem just with another plugin. I think I could solve this when I use a parent build.gradle and subprojects{}. But this is exactly the reason why I leave maven and move to gradle. My sub-modules can and should also live independently with different versions.