'Cycle in Gradle task due to plugins
Environment:
- JDK 17
- Gradle 7.4.2
- org.moditect.gradleplugin 1.0.0-rc.3
- com.github.gmazzo.buildconfig 3.0.3
I try to use jPackager for creating application images. I encountered that jPackager cannot cope with packages that "just" define an automatic module name. So I want to use Moditect to modify the dependencies to avoid their automatic module name property. This seems to work quite well. However I get a circular dependency in Gradle as soon as I enable the buildconfig
plugin at the same time.
FAILURE: Build failed with an exception.
* What went wrong:
Circular dependency between the following tasks:
:addDependenciesModuleInfo
+--- :generateModuleInfo
| \--- :jar
| \--- :classes
| \--- :compileJava
| \--- :addDependenciesModuleInfo (*)
\--- :jar (*)
(*) - details omitted (listed previously)
Is there any way of breaking/avoiding this circular dependency or is there no way but to choose other plugins?
import java.time.LocalDate
plugins {
id 'application'
id 'distribution'
id 'java'
id 'com.github.gmazzo.buildconfig' version "3.0.3"
id 'org.openjfx.javafxplugin' version '0.0.11'
id "org.panteleyev.jpackageplugin" version "1.3.1"
id "org.moditect.gradleplugin" version "1.0.0-rc3" // FIXME Creates circular dependency with buildconfig
}
group 'bayern.steinbrecher'
version '0.1'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
sourceCompatibility = 17
targetCompatibility = 17
dependencies {
implementation "bayern.steinbrecher:CheckedElements:0.13-rc.10-SNAPSHOT"
implementation "bayern.steinbrecher:JavaUtility:0.18"
implementation 'bayern.steinbrecher:ScreenSwitcher:0.2.4'
implementation 'com.itextpdf:kernel:7.1.17'
implementation 'com.itextpdf:io:7.1.17'
implementation 'com.itextpdf:layout:7.1.17'
implementation 'org.jetbrains:annotations:22.0.0'
}
run {
main = "$moduleName/bayern.steinbrecher.woodpacker.WoodPacker"
}
buildConfig {
buildConfigField("String", "APP_NAME", "\"${project.name}\"")
buildConfigField("String", "APP_VERSION", "\"${project.version}\"")
buildConfigField("String", "APP_VERSION_NICKNAME", "\"Das Alpha-Tier\"")
buildConfigField("long", "BUILD_TIME", "${System.currentTimeMillis()}L")
packageName("bayern.steinbrecher.woodpacker")
}
tasks.register("copyInstallerDeps", Copy) {
from(configurations.runtimeClasspath)
into("$buildDir/installer/files")
}
tasks.register("copyInstallerJars", Copy) {
from(tasks.jar)
into("$buildDir/installer/files")
}
tasks.jpackage {
dependsOn("build", "copyInstallerDeps", "copyInstallerJars")
appName = "\"${project.name}\""
appVersion = "\"${project.version}\""
vendor = "StoneSoft"
copyright = "Copyright (c) ${LocalDate.now().getYear()} $vendor"
module = "$run.main"
modulePaths = file("$buildDir/installer/files").listFiles() as List<String>
destination = "$buildDir/installer"
windows {
icon = "imageTemplates/logo.ico"
winDirChooser = true
winMenu = true
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|