-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classpath is too long 206 error #1125
Comments
@krystiankk Can you please try using this plugin and let us know if it solves the issue? https://github.com/viswaramamoorthy/gradle-util-plugins |
@marcphilipp I did fix it doing below, but then I found this classpath plugin and yes it works just fine. I did post it on Stack as well https://stackoverflow.com/questions/46827241/junit5-gradle-plugin-the-filename-or-extension-is-too-long def version = "5.0.1"
def platformVersion = "1.0.1"
def vintageVersion = "4.12.1"
def projectCp = "${project.name}Classpath.jar"
dependencies {
compile "org.junit.jupiter:junit-jupiter-api:$version"
compile "org.junit.platform:junit-platform-launcher:$platformVersion"
compile "org.junit.platform:junit-platform-runner:$platformVersion"
testCompile "junit:junit:4.12"
testCompile "org.junit.jupiter:junit-jupiter-params:$version"
testRuntime "org.junit.vintage:junit-vintage-engine:$vintageVersion"
testRuntime "org.junit.platform:junit-platform-console:$platformVersion"
testRuntime "org.junit.jupiter:junit-jupiter-engine:$version"
}
afterEvaluate {
if (!project.tasks.findByName('packClasspath')) {
task packClasspath(type: Jar) {
archiveName = projectCp
version = ''
manifest {
attributes 'Class-Path':
project.configurations.testRuntime.collect { "file:///${it.absolutePath}" }.join(' ')}
}
}
if (!project.tasks.findByName('jupiterTest')) {
task jupiterTest(type: JavaExec) {
jvmArgs '-ea'
classpath = files(
"${project.buildDir}\\libs\\${projectCp}",
project.sourceSets.test.output,
project.sourceSets.main.output,
)
main 'org.junit.platform.console.ConsoleLauncher'
args '--scan-class-path'
args "--reports-dir=$project.testReportDir"
}
}
test.dependsOn jupiterTest
jupiterTest.dependsOn packClasspath
jupiterTest.dependsOn testClasses
test.enabled = false
} |
Thanks for letting us know! @junit-team/junit-lambda Do you think we should build such a "manifest JAR" by default in our Gradle plugin? |
No problem! I'm glad I could help. Ps. I am wondering how does Gradle natively run JUnit4 tests that those work with long classpaths atm? |
I'm not sure, they're bound to be doing something similar. |
Since Gradle now provides native support for running tests on the JUnit Platform, the classpath length should no longer be an issue. We've decided to deprecate our custom plugin (see #1317 for details) and not add any new features to it. Thus, I'm closing this issue. |
When running Junit5 on our huge project we are getting our classpath to the size of 35.8k when Windows (unfortunately) supports 32k only. I'm not sure how JUnit4 tests are handled in Gradle but it all works fine.
This is how its done in the plugin and it seems to do what it says but it creates a massive classpath and we are using Windows, sadly.
classpath = project.sourceSets.test.runtimeClasspath + project.configurations.junitPlatform
Is there any way we can work around this issue? it seems to pull the whole world into the classpath with all transitives.
I Have created stack overflow question as well for this.
https://stackoverflow.com/questions/46827241/junit5-gradle-plugin-the-filename-or-extension-is-too-long
The text was updated successfully, but these errors were encountered: