-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Support mvn spring-boot:run with classpaths that exceeds Windows' length limits #17766
Comments
Out of interest, have you tried this: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/ |
@philwebb Thank you for that hint. I tried it but sadly it does not work in this case. Still getting the same exception :-/ Maybe it is not about the filepath length limit.
stating that the command line length is limited to 32767 characters. |
Thanks for trying, we'll have to try and investigate what options we have. |
I believe There's some interesting discussion of this in a couple of Gradle issues: gradle/gradle#1989 and gradle/gradle#10114. A pathing jar (jar that's used purely to declare the classpath via its manifest) is the most common solution but those issues point out some notable downsides. The latter of the two is tracking a fix for the problem that would mean we don't need to do anything on the Gradle side when using Gradle 6+. |
I have the same issue with 2.2.0.RELEASE but works fine with 2.1.9.RELEASE. |
I have similar issue with 2.2.0.RELEASE and 2.2.1.RELEASE while 2.1.10.RELEASE works fine. It could be the classpath which in my case is around 37500 characters. |
We are also experiencing this issue when upgrading to 2.2.0.RELEASE. Discovered our classpath was roughly 38000 characters long The work-around we took was moving the USER_HOME/.m2/repository to C:/m2 |
For those experiencing the problem on update, I would guess that there's now an extra transitive dependency or some version numbers have gained an extra digit and this has been enough to cause the length of the classpath to exceed Windows' limits. You may want to compare the old classpath with the new to identity where the extra length has been introduced. |
We are experiencing same issue with Spring Boot 1.5.13.RELEASE, Maven 3.6.3. Please throw some light on this.
|
this works for me: |
Forking is enabled by default since Spring Boot 2.2. |
Why not being able to customize the plugin to use a file classpath (@argfile) ? Intellij offers this possibility to shorten the size of the arguments. |
Wouldn't it be possible to switch the classpath from the command line (-cp) to the CLASSPATH environment variable? This would reduce the length of the command line drastically. I forked spring-boot to give this option a try. |
@cquoss That might be an option, although I suspect it would work when the |
Yeah. But why not have it work with fork, too? |
Well. My PR was rejected. I wanted to use CLASSPATH env var instead of -cp command line option. You mentioned something of a better solution being using the Classpath entry in MANIFEST.MF of a dedicated classpath-only jar. But how is this activated when using spring-boot:run Maven goal on the Windows command line? How has the POM file to be changed to use this? Please advise. Please note: My solution would have worked out-of-the-box. No changes in POM etc. needed. |
@cquoss There's currently no way configure the POM file to use a pathing jar. We'd need to make changes to the code in order to support long paths. |
Well then. Looks like my solution goes into a customized spring-boot maven plugin, then, here at our site. We need a solution. |
Not applicable to Windows server 2012. |
I would try a workaround description of what did work for us @regmebaby sources states that
In order to diagnose your classpath length, use mvn debug mode (ie. To make shortest your classpath component (java home and .m2), you could use this @rekhubs sources tips (
Then try again(I'm using git bash)
Windows <3 |
This has become more relevant for Spring Boot 3 since |
This thread is about spring-boot:run, but we also have a scenario for spring-boot:start |
We're now using an argfile when running on Windows. I explored the avenue with the pathing JAR, however it was a lot more code (because we need to separate directories from JARs, because only JARs can go in the manifest) and other funny stuff. The argfile change is pretty minimal. |
Hi there, we use Spring Boot Version 2.1.5.RELEASE + maven 3.6.0 on a windows 10 machine to develop a spring webmvc application.
When invoking
mvn spring-boot:run
the following exception occurs:Problem: Our classpath is too long as we have many dependencies.
A feature/fix to shorten the command line in such cases (e.g. use of temp argFile) would be awesome.
The text was updated successfully, but these errors were encountered: