Juanma Leflet Estrada
03/26/2024, 11:31 AMmavelLocal()
repo. I now intend to call this plugin for projects, ideally without modifying their build.gradle
file.
Apparently the most reasonable way of doing this is placing the plugin's apply
in an init file (there was some talk in github about implementing something else to be able to call plugins from the CLI, but as far as I can see it didn't get anywhere)
Now, calling it from the target project's build.gradle
file seems to work fine, but when I try to do apply plugin: 'org.konveyor.java.plugin:konveyor-download-sources:1.0-SNAPSHOT'
from the init file, it fails. My init file looks like this:
buildscript {
repositories {
mavenLocal() // Repository where your plugin is hosted
}
dependencies {
classpath 'org.konveyor.java.plugin:konveyor-download-sources:1.0-SNAPSHOT'
}
}
apply plugin: 'org.konveyor.java.plugin:konveyor-download-sources:1.0-SNAPSHOT'
Any help would be appreciated, thanks!Juanma Leflet Estrada
03/26/2024, 11:32 AMPlugin with id 'org.konveyor.java.plugin:konveyor-download-sources:1.0-SNAPSHOT' not found.
ephemient
03/26/2024, 12:28 PMapply plugin:
takes a plugin id, not an artifact coordinateephemient
03/26/2024, 12:32 PMJuanma Leflet Estrada
03/26/2024, 12:34 PMJuanma Leflet Estrada
03/26/2024, 12:35 PMJuanma Leflet Estrada
03/26/2024, 12:36 PMJuanma Leflet Estrada
03/26/2024, 12:37 PMJuanma Leflet Estrada
03/26/2024, 12:40 PMDaniel B Duval
03/26/2024, 3:58 PMorg.konveyor.java.plugin
. But I did get this concept working with an init script before with other plug ins.
if (gradle.getParent() == null) {
beforeSettings { settings ->
settings.buildscript.repositories { mavenLocal() }
settings.buildscript.dependencies.add("classpath", "org.konveyor.java.plugin:konveyor-download-sources:1.0-SNAPSHOT")
}
settingsEvaluated { settings ->
if (!settings.pluginManager.hasPlugin("org.konveyor.java.plugin")) {
settings.pluginManager.apply("org.konveyor.java.plugin")
}
}
}
Juanma Leflet Estrada
03/26/2024, 4:00 PMephemient
03/26/2024, 4:00 PMJuanma Leflet Estrada
03/26/2024, 4:00 PMJuanma Leflet Estrada
03/26/2024, 4:01 PMJuanma Leflet Estrada
03/26/2024, 4:02 PMJuanma Leflet Estrada
03/26/2024, 4:03 PMJuanma Leflet Estrada
03/26/2024, 4:03 PMDaniel B Duval
03/26/2024, 4:05 PMephemient
03/26/2024, 4:12 PMbuildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "..."
}
}
settingsEvaluated { // or rootProject or allprojects, depending on the desired target(s)
pluginManager.apply("...")
}
instead of mucking with the child buildscripts, if the classpath is inheritedDaniel B Duval
03/26/2024, 4:15 PMJuanma Leflet Estrada
03/26/2024, 4:24 PMJuanma Leflet Estrada
03/26/2024, 4:25 PMJuanma Leflet Estrada
03/26/2024, 4:33 PMCaused by: java.lang.ClassCastException: class org.gradle.initialization.DefaultSettings_Decorated cannot be cast to class org.gradle.api.Project (org.gradle.initialization.DefaultSettings_Decorated and org.gradle.api.Project are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @55f3ddb1)
Not sure if it's caused by the init scriptephemient
03/26/2024, 4:34 PMephemient
03/26/2024, 4:34 PMDaniel B Duval
03/26/2024, 4:39 PM$GRADLE_USER_HOME/init.d/
path. Shouldn’t make a difference, but I was trying to just build an environment for anyone and have a set of plug-ins applied by using the set up I had defined.Daniel B Duval
03/26/2024, 4:46 PMephemient
03/26/2024, 4:50 PMdependencyResolutionManagement {
repositories {
maven {
...
}
}
repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
}
in settings
Juanma Leflet Estrada
03/26/2024, 4:54 PMinit.d
or anywhere else and doing ---init-script
?Juanma Leflet Estrada
03/26/2024, 4:55 PMJuanma Leflet Estrada
03/26/2024, 5:02 PMJuanma Leflet Estrada
03/26/2024, 5:03 PM