Java 无法解析项目,所有耗材配置都没有属性
我的Jenkins管道显示如下错误消息:Java 无法解析项目,所有耗材配置都没有属性,java,gradle,build,project,Java,Gradle,Build,Project,我的Jenkins管道显示如下错误消息: FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':distTar'. > Could not resolve all task dependencies for configuration ':runtimeClasspath'. > Could not resolve
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':distTar'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
> Could not resolve project :ProjectA.
Required by:
project :
> Unable to find a matching configuration of project :ProjectA:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectB.
Required by:
project :
> Unable to find a matching configuration of project :ProjectB:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectC.
Required by:
project :
> Unable to find a matching configuration of project :ProjectC:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectD.
Required by:
project :
> Unable to find a matching configuration of project :ProjectD:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectE.
Required by:
project :
> Unable to find a matching configuration of project :ProjectE:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectF.
Required by:
project :
> Unable to find a matching configuration of project :ProjectF:
- None of the consumable configurations have attributes.
plugins {
id "java-library"
id "application"
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'application'
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
flatDir { dirs 'lib' } }
configurations {
implementation
// A configuration meant for consumers that need the API of this component
exposedApi {
// This configuration is an "outgoing" configuration, it's not meant to be resolved
canBeResolved = true
// As an outgoing configuration, explain that consumers may want to consume it
canBeConsumed = true
}
// A configuration meant for consumers that need the implementation of this component
exposedRuntime {
canBeResolved = true
canBeConsumed = true
}
// declare a configuration that is going to resolve the compile classpath of the application
compileClasspath.extendsFrom(implementation)
// declare a configuration that is going to resolve the runtime classpath of the application
runtimeClasspath.extendsFrom(implementation)
}
configurations.compile.resolutionStrategy {
force project }
dependencies {
implementation project(':ProjectA')
implementation project(':ProjectB')
implementation project(':ProjectC')
implementation project(':ProjectD')
implementation project(':ProjectE')
implementation project(':ProjectF')
implementation fileTree(dir: 'lib', include: '*.jar')
implementation fileTree(dir: '../ProjectA/lib', include: '*.jar') implementation fileTree(dir: '../ProjectA/lib/gson', include: '*.jar')
implementation fileTree(dir: 'lib/symbol', include: '*.jar') implementation fileTree(dir: 'lib/symbol/lib', include: '*.jar') implementation fileTree(dir: '../ ProjectC/C/framework/libraries', include: '*.jar')
implementation fileTree(dir: '../ ProjectC/C/framework', include: '*.jar')
api 'org.apache.commons:commons-math3:3.6.1'
api 'junit:junit:4.12'
// Use JUnit test framework
// This dependency provides the public API for writing tests and extensions
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-migrationsupport', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.1'
testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.4.1'
testCompile group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.4.1'
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.5.0-M1'
testCompile group: 'junit', name: 'junit', version: '4.12'
//This dependency provides TestFX
testCompile group: "org.testfx", name: "testfx-core", version: "4.0.15-alpha"
testCompile group: "org.testfx", name: "testfx-junit", version: "4.0.15-alpha"
testCompile group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181.1'
implementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.15-alpha'
// This dependency runs tests in JUnit 5, 4, 3
testRuntime(
'org.junit.jupiter:junit-jupiter-engine:5.4.1',
'org.junit.vintage:junit-vintage-engine:5.4.1',
'org.testfx:openjfx-monocle:jdk-9+181.1'
)
}
test {
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" } }
wrapper { gradleVersion = '5.5.1' }
eclipse { classpath {
downloadSources = true
downloadJavadoc = true } }
task sourceJar (type : Jar) { classifier = 'sources'
from sourceSets.test.allSource }
mainClassName = 'id.blablu.test.main.StartMainTest'
compileJava.options.encoding = 'UTF-8'
processResources {
from ('src/test/java') {
include ('**/*.properties') } from('C:/workspace/ProjectD/src'){ include ('**/*.properties') } }
sourceSets {
test{
java {
srcDir 'src/test/java'
}
}
}
def ArrayList vmArgs = ["-Dfile.encoding=UTF8"] if(JavaVersion.current() >= JavaVersion.VERSION_11) { vmArgs = vmArgs
+ [
"--add-modules", "javafx.base",
"--add-modules", "javafx.graphics",
"--add-modules", "javafx.controls",
"--add-modules", "javafx.fxml",
"--add-modules", "javafx.media",
"--add-modules", "javafx.swing",
"--add-modules", "javafx.web"
] }
run {
doFirst {
if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
jvmArgs = vmArgs + [
"--module-path", classpath.asPath
]
} else {
jvmArgs = vmArgs
}
} }
application {
if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
applicationDefaultJvmArgs = vmArgs + [
"--module-path", "../lib"
] } else { applicationDefaultJvmArgs = vmArgs } }
我在网上学习了一些教程,但似乎没有一个教程发布了如何使用配置属性配置依赖项的完整步骤
我的build.gradle是这样的:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':distTar'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
> Could not resolve project :ProjectA.
Required by:
project :
> Unable to find a matching configuration of project :ProjectA:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectB.
Required by:
project :
> Unable to find a matching configuration of project :ProjectB:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectC.
Required by:
project :
> Unable to find a matching configuration of project :ProjectC:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectD.
Required by:
project :
> Unable to find a matching configuration of project :ProjectD:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectE.
Required by:
project :
> Unable to find a matching configuration of project :ProjectE:
- None of the consumable configurations have attributes.
> Could not resolve project :ProjectF.
Required by:
project :
> Unable to find a matching configuration of project :ProjectF:
- None of the consumable configurations have attributes.
plugins {
id "java-library"
id "application"
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'application'
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
flatDir { dirs 'lib' } }
configurations {
implementation
// A configuration meant for consumers that need the API of this component
exposedApi {
// This configuration is an "outgoing" configuration, it's not meant to be resolved
canBeResolved = true
// As an outgoing configuration, explain that consumers may want to consume it
canBeConsumed = true
}
// A configuration meant for consumers that need the implementation of this component
exposedRuntime {
canBeResolved = true
canBeConsumed = true
}
// declare a configuration that is going to resolve the compile classpath of the application
compileClasspath.extendsFrom(implementation)
// declare a configuration that is going to resolve the runtime classpath of the application
runtimeClasspath.extendsFrom(implementation)
}
configurations.compile.resolutionStrategy {
force project }
dependencies {
implementation project(':ProjectA')
implementation project(':ProjectB')
implementation project(':ProjectC')
implementation project(':ProjectD')
implementation project(':ProjectE')
implementation project(':ProjectF')
implementation fileTree(dir: 'lib', include: '*.jar')
implementation fileTree(dir: '../ProjectA/lib', include: '*.jar') implementation fileTree(dir: '../ProjectA/lib/gson', include: '*.jar')
implementation fileTree(dir: 'lib/symbol', include: '*.jar') implementation fileTree(dir: 'lib/symbol/lib', include: '*.jar') implementation fileTree(dir: '../ ProjectC/C/framework/libraries', include: '*.jar')
implementation fileTree(dir: '../ ProjectC/C/framework', include: '*.jar')
api 'org.apache.commons:commons-math3:3.6.1'
api 'junit:junit:4.12'
// Use JUnit test framework
// This dependency provides the public API for writing tests and extensions
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-migrationsupport', version: '5.4.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.1'
testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.4.1'
testCompile group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.4.1'
testCompile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.5.0-M1'
testCompile group: 'junit', name: 'junit', version: '4.12'
//This dependency provides TestFX
testCompile group: "org.testfx", name: "testfx-core", version: "4.0.15-alpha"
testCompile group: "org.testfx", name: "testfx-junit", version: "4.0.15-alpha"
testCompile group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181.1'
implementation group: 'org.testfx', name: 'testfx-junit5', version: '4.0.15-alpha'
// This dependency runs tests in JUnit 5, 4, 3
testRuntime(
'org.junit.jupiter:junit-jupiter-engine:5.4.1',
'org.junit.vintage:junit-vintage-engine:5.4.1',
'org.testfx:openjfx-monocle:jdk-9+181.1'
)
}
test {
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" } }
wrapper { gradleVersion = '5.5.1' }
eclipse { classpath {
downloadSources = true
downloadJavadoc = true } }
task sourceJar (type : Jar) { classifier = 'sources'
from sourceSets.test.allSource }
mainClassName = 'id.blablu.test.main.StartMainTest'
compileJava.options.encoding = 'UTF-8'
processResources {
from ('src/test/java') {
include ('**/*.properties') } from('C:/workspace/ProjectD/src'){ include ('**/*.properties') } }
sourceSets {
test{
java {
srcDir 'src/test/java'
}
}
}
def ArrayList vmArgs = ["-Dfile.encoding=UTF8"] if(JavaVersion.current() >= JavaVersion.VERSION_11) { vmArgs = vmArgs
+ [
"--add-modules", "javafx.base",
"--add-modules", "javafx.graphics",
"--add-modules", "javafx.controls",
"--add-modules", "javafx.fxml",
"--add-modules", "javafx.media",
"--add-modules", "javafx.swing",
"--add-modules", "javafx.web"
] }
run {
doFirst {
if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
jvmArgs = vmArgs + [
"--module-path", classpath.asPath
]
} else {
jvmArgs = vmArgs
}
} }
application {
if(JavaVersion.current() >= JavaVersion.VERSION_1_9) {
applicationDefaultJvmArgs = vmArgs + [
"--module-path", "../lib"
] } else { applicationDefaultJvmArgs = vmArgs } }
如果有人拥有完整的依赖项及其属性配置,请向我展示或
请告诉我如何配置配置属性
谢谢