allegro / allegro/axion-release-plugin

SecurityException when configuring and using axion plugin from buildSrc

Offen
#581 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Groovy
Sterne
641
Forks
165
Ø Merge
49 Min.
Gemergte PRs (30 T.)
9

Beschreibung

I try to declare and configure `axion-release-plugin` from `buildSrc` directory and `libs.versions.toml` versions catalog file with Gradle-7.6 and JDK-17. Then we have

- In `libs.versions.toml`:
```
[libraries]
(...)
axion-release-plugin = { module = "pl.allegro.tech.build:axion-release-plugin", version="1.14.4" }
(...)
```
- In `buildSrc/build.gradle.kts`:
```
dependencies {
(...)
implementation( libs.axion.release.plugin )
(...)
}
```
- In `buildSrc/src/main/kotlin/xxx.java-conventions.gradle.kts`:
```
plugins {
(...)
id("pl.allegro.tech.build.axion-release")
}
scmVersion {
tag {
prefix.set("")
}
}
version=scmVersion.version
```

When I try to access version property from `scmVersion` in `xxx.java-conventions.gradle.kts` as described above, I face a SecurityException that prevent the build to execute (it does not occur if `scmVersion` is not accessed):
```
> ./gradlew projects

FAILURE: Build failed with an exception.

* Where:
Build file '/home/erict/workspaces/xxx/xxx/build.gradle.kts' line: 1

* What went wrong:
An exception occurred applying plugin request [id: 'xxx.java-conventions']
> Failed to apply plugin 'xxx.java-conventions'.
> class "org.eclipse.jgit.transport.JschConfigSessionFactory"'s signer information does not match signer information of other classes in the same package
```

It may be caused by some other plugins using a more recent version of jGit but even with the help of the documentation, I wasn't able to fix it.
It perfectly works however when the plugin is declared in the `[plugins]` of the catalog file and configured and used in the `build.gradle.kts` files of each module. Moving this declaration in `build.gradle.kts` of root project avoid code duplicates, thanks to a little trick that applies root version to subprojects.

However, this is not satisfying as buildSrc directory is here to allow build logic sharing.
[Full stacktrace](https://github.com/allegro/axion-release-plugin/files/10708425/axion_stacktrace.txt) is attached to this issue.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.