Skip to content

virgo47/gradle-classpath-jar-plugin

Repository files navigation

gradle-classpath-jar-plugin

Overview

When classpath for a Gradle JavaExec or Test task is long, Windows command executions give error because of limitation to command line length greater than 32K.

With a number of classpath dependencies in a large project, typically JavaExec Gradle task fails with error "The filename or extension is too long" and this would be a stopping error. To solve this issue, use ClasspathJar plugin.

ClasspathJar plugin creates a classpath jar for jar files in the classpath of every JavaForkOptions task and sets the classpath with classpath jar. This includes JavaExec, Test and other similar tasks.

History

My story started with the problem, followed with a blog post. Then I found a plugin only to discover it had a bug that stays hidden if you don’t use spaces in path.

This plugin is clone of https://github.com/eshepelyuk/gradle-util-plugins which itself is clone of other "gradle-util-plugins".

My version uses toURI() instead of toURL() to process classpath items which should fix file paths with spaces. Original repo didn’t have Issues tab, so I couldn’t report it easily. I also wanted to start with Gradle plugins and this one is as good as any other for that plus I can scratch my own itch.

TODO: I should have added test for this but right now it’s beyond my Gradle skill.

Also it’s not possible to upgrade from Gradle 4.7 to 4.8 and higher, as it breaks half the tests. See: https://discuss.gradle.org/t/plugin-tests-using-project-tasks-test-worked-in-4-7-but-fail-with-4-8/29340?u=virgo47

Version Compatibility

  • Gradle 4.7, does NOT work with 4.8 or higher (failing test).

  • Java 8/JDK 1.8.

Installation

Follow the steps described at Gradle Plugin Portal page.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages