Git Product home page Git Product logo

viswaramamoorthy / gradle-util-plugins Goto Github PK

View Code? Open in Web Editor NEW
90.0 4.0 9.0 61 KB

Fix for windows gradle long classpath issue. Fixes JavaExec tasks that error out with message "CreateProcess error=206, The filename or extension is too long"

License: MIT License

Groovy 100.00%
windows classpath issue manifest jar plugin gradle windows-gradle-long-classpath manifestclasspath-plugin javaexec-task

gradle-util-plugins's Introduction

gradle-util-plugins

When classpath for a Gradle JavaExec 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 ManifestClasspath plugin.

ManifestClasspath plugin creates a manifest jar for jar files in the classpath of JavaExec task and sets the classpath with manifest jar.

Usage

To use the plugin, define a dependency in build script and have plugin entry in Gradle project.

build.gradle snippet to use ManifestClasspath plugin

Build script snippet for plugins DSL for Gradle 2.1 and later
plugins {
  id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
Build script snippet for use in older Gradle versions or where dynamic configuration is required
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.github.viswaramamoorthy:gradle-util-plugins:0.1.0-RELEASE"
  }
}

apply plugin: "com.github.ManifestClasspath"

Build

./gradlew build

gradle-util-plugins's People

Contributors

viswaramamoorthy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gradle-util-plugins's Issues

Still having the issue with longClassPath

I am still having issue with Long Classpath after applying the plugin
java.io.IOException: Cannot run program "java": CreateProcess error=206, The filename or extension is too long
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.ford.auto.parallel.runtime.ParallelFeatureRunner.run(ParallelFeatureRunner.java:27)
at com.ford.auto.parallel.runtime.ParallelRunner.runFeature(ParallelRunner.java:143)
at com.ford.auto.parallel.runtime.ParallelRunner.lambda$0(ParallelRunner.java:47)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

InvalidUserDataException using this plugin in Gradle 5.1.1

When I apply this plugin to my project, I get the following exception:

Caused by: org.gradle.api.InvalidUserDataException: Main class name has not been configured and it could not be resolved
        at org.springframework.boot.gradle.plugin.MainClassConvention.lambda$resolveMainClass$0(MainClassConvention.java:67)
        at org.springframework.boot.gradle.plugin.MainClassConvention.resolveMainClass(MainClassConvention.java:67)
        at org.springframework.boot.gradle.plugin.MainClassConvention.call(MainClassConvention.java:62)
        at org.gradle.util.GUtil.uncheckedCall(GUtil.java:459)
        at org.gradle.api.internal.ConventionAwareHelper$2.doGetValue(ConventionAwareHelper.java:82)
        at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:126)
        at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:109)
        at org.springframework.boot.gradle.tasks.run.BootRun_Decorated.getMain(Unknown Source)
        at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:77)
        at org.springframework.boot.gradle.tasks.run.BootRun.exec(BootRun.java:50)

I'll try to post a minimal test case tomorrow.

I have a multi-module project, so it could be(?) related to:
#8

If plugin is applied to more than one project in a multi-build project, the resulting manifest jars are incorrect

The listener is applied at a global scope => it receives notifications from all tasks in the multi-build. If two separate build.gradle files apply the plugin, two listeners are created and they both transform each JavaExec task => the second and later end up writing a manifest jar the points to itself:

Manifest-Version: 1.0
Class-Path: file:/C:/repos/.../build/mfjars/taskName_ManifestJar.jar

Can't get it working

Hi there! We've been trying to apply this plugin in the project FastHub, but it still throws CreateProcess error=206.
We have also tried to manipulate with apply location without any success.

Here are commits and build results:

Commit AppVeyor CI Build
k0shk0sh/FastHub@5e84f79 https://ci.appveyor.com/project/k0shk0sh/fasthub/build/342
k0shk0sh/FastHub@c1bc5b1 https://ci.appveyor.com/project/k0shk0sh/fasthub/build/345
k0shk0sh/FastHub@bc787c2 https://ci.appveyor.com/project/k0shk0sh/fasthub/build/347

Can you help us, please?

README.md

typo in ./gradelw build

must be ./gradlew build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.