I have configured the following test suite:
testing {
suites {
localTest(JvmTestSuite) {
useJUnitJupiter()
dependencies {
implementation project(':app')
def imp = project(':app').getConfigurations().getAsMap().get("implementation")
if (imp) {
imp.dependencies.forEach {
implementation it
}
}
}
}
}
}
that I use in several gradle modules to have the app project and its dependencies available when running the test. This works fine for regular dependencies.
However, I also have this extra module info defined:
extraJavaModuleInfo {
module("com.vladsch.flexmark:flexmark", "com.vladsch.flexmark") {
mergeJar('com.vladsch.flexmark:flexmark-util-data')
mergeJar('com.vladsch.flexmark:flexmark-util-format')
mergeJar('com.vladsch.flexmark:flexmark-util-ast')
mergeJar('com.vladsch.flexmark:flexmark-util-sequence')
mergeJar('com.vladsch.flexmark:flexmark-util-builder')
mergeJar('com.vladsch.flexmark:flexmark-util-html')
mergeJar('com.vladsch.flexmark:flexmark-util-dependency')
mergeJar('com.vladsch.flexmark:flexmark-util-collection')
mergeJar('com.vladsch.flexmark:flexmark-util-misc')
mergeJar('com.vladsch.flexmark:flexmark-util-visitor')
exportAllPackages()
}
}
In the app project, I have all dependencies added:
dependencies {
implementation 'com.vladsch.flexmark:flexmark:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-data:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-ast:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-builder:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-sequence:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-misc:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-dependency:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-collection:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-format:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-html:0.64.0'
implementation 'com.vladsch.flexmark:flexmark-util-visitor:0.64.0'
}
When I try to run the localTest suite in another module, lets call it the ext gradle module, which uses the app module for tests in its test suite, I get the following error:
Execution failed for task ':ext:compileLocalTestJava'.
> Could not resolve all files for configuration ':ext:localTestCompileClasspath'.
> Failed to transform flexmark-0.64.0.jar (com.vladsch.flexmark:flexmark:0.64.0) to match attributes {artifactType=jar, javaModule=true, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
> Execution failed for ExtraJavaModuleInfoTransform: C:\Users\Christopher Schnick\.gradle\caches\modules-2\files-2.1\com.vladsch.flexmark\flexmark\0.64.0\bb5fcdf1335a35c4c0285fee2683a32e6a70cd59\flexmark-0.64.0.jar.
> Jar not found: com.vladsch.flexmark:flexmark-util-data
However, if I add only one dependency to the ext gradle module, it fixes the problem:
dependencies {
implementation 'com.vladsch.flexmark:flexmark-util-data:0.64.0'
}
This behavior is a little bit unexpected. I either expected it to require me to define all dependencies again or work without having to do that. I'm not sure whether that is a bug though.
I have configured the following test suite:
that I use in several gradle modules to have the
appproject and its dependencies available when running the test. This works fine for regular dependencies.However, I also have this extra module info defined:
In the
appproject, I have all dependencies added:When I try to run the
localTestsuite in another module, lets call it theextgradle module, which uses the app module for tests in its test suite, I get the following error:However, if I add only one dependency to the
extgradle module, it fixes the problem:This behavior is a little bit unexpected. I either expected it to require me to define all dependencies again or work without having to do that. I'm not sure whether that is a bug though.