我配置了一个 GitHub 工作流程来使用
gradle-build-action
收集和提交 Gradle 依赖项,而后者又使用 github-dependency-graph-gradle-plugin
。对于某些存储库来说,这工作得很好,但对于一个存储库来说,它什么也没找到。我期待看到列出的 javafx 依赖项。我该如何解决这个问题?
此存储库正在运行 Gradle v 8.2.1
以下是 GitHub 工作流程的相关部分:
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/gradle-build-action@v2
with:
dependency-graph: generate-and-submit
- name: Run a build, generating the dependency graph from 'runtimeClasspath' configurations
run: ./gradlew build --exclude-task test
env:
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: runtimeClasspath
这是
.\gradlew touchtime:dependencies --configuration runtimeClasspath
的输出:
------------------------------------------------------------
Project ':touchtime'
------------------------------------------------------------
runtimeClasspath - Runtime classpath of source set 'main'.
+--- org.openjfx:javafx-base:15
+--- org.openjfx:javafx-graphics:15
| \--- org.openjfx:javafx-base:15
+--- org.openjfx:javafx-controls:15
| \--- org.openjfx:javafx-graphics:15 (*)
+--- org.openjfx:javafx-fxml:15
| \--- org.openjfx:javafx-controls:15 (*)
+--- org.openjfx:javafx-swing:15
| \--- org.openjfx:javafx-graphics:15 (*)
+--- org.controlsfx:controlsfx:8.40.12
\--- org.openjfx:javafx:15.0.1
这是依赖插件生成的 JSON 文件:
{
"version" : 0,
"job" : {
"id" : "5977018633",
"correlator" : "dependencies-depend-submit"
},
"sha" : "7c7f4c854a2a5129ff0776b017b6838d20cd9c61",
"ref" : "refs/heads/main",
"detector" : {
"name" : "GitHub Dependency Graph Gradle Plugin",
"version" : "0.2.0",
"url" : "https://github.com/gradle/github-dependency-graph-gradle-plugin"
},
"manifests" : {
"dependencies-depend-submit" : {
"name" : "dependencies-depend-submit",
"resolved" : { },
"file" : {
"source_location" : "settings.gradle"
}
}
},
"scanned" : "2023-08-25T14:21:33Z"
}
如果有帮助,这里是
build.gradle
脚本:
import java.text.SimpleDateFormat
plugins {
id 'java-library'
id 'org.openjfx.javafxplugin' version '0.0.13'
}
javafx {
version = '15'
modules = ['javafx.base', 'javafx.fxml', 'javafx.controls',
'javafx.graphics', 'javafx.swing'
]
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
configurations {
extraLibs
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.controlsfx:controlsfx:8.40.12'
implementation 'org.openjfx:javafx:15.0.1'
implementation files('dist/Classes.jar')
extraLibs group: 'org.controlsfx', name: 'controlsfx', version: '8.40.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.9.3")
testImplementation 'org.mockito:mockito-core:5.4.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.4.0'
}
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
doLast {
new File("$buildDir/baseVersion.txt").text = gradle.ext.baseVersion
new File("$buildDir/deployVersion.txt").text = gradle.ext.deployVersion
}
}
jar {
compileJava.options.debugOptions.debugLevel = "source,lines,vars"
//Build MANIFEST.MF
manifest {
attributes 'Built-By' : System.properties['user.name']
attributes 'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date())
attributes 'Created-By' : "Gradle ${gradle.gradleVersion}"
attributes 'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})"
attributes 'Manifest-Version': gradle.ext.baseVersion
attributes 'Deploy-Package': gradle.ext.deployVersion
attributes 'Main-Class': gradle.ext.mainClass
}
// Add controlsFX Source Files into JAR output
from {
configurations.extraLibs.collect{
it.isDirectory() ? it: zipTree(it)
}
}
// Set output to dist/App.jar
archiveBaseName.set("App")
destinationDirectory.set(file("$rootDir/touchtime/dist"))
}
test {
useJUnitPlatform()
}
只有当
--exclude-task test
中的 gradle
调用它被删除时,它才开始工作。
TL;博士;
我尝试使用不同的
gradle-build-action
版本(v2、v2.8.0、v2.5.0 等),尝试使用不同的 dependency-graph:
值(生成、生成并提交...),指定 gradle-version
,添加cache-disabled : true
。
还尝试在
gradle.wrapper
中指定不同的 gradle 版本而不是 gradle-version
参数,在 --no-configuration-cache --no-build-cache
中添加 run: gradlew
参数。
工作流断言输出没有任何变化,不会生成依赖关系图,直到
--exclude-task
将其删除(请注意,用于排除任务的 -x
参数会产生相同的效果)。这对我有用:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/[email protected]
with:
gradle-version: 8.2.1
#cache-disabled: true
dependency-graph: generate
- run: ./gradlew build