#The File or extention is too long
1 messages · Page 1 of 1 (latest)
<@&1004656351647117403> please have a look, thanks.
hello
it seems you're using springboot maven plugin to run a java program
Yes
alright, first u need to make sure the project compiles
./mvnw clean install
tht means u have errors in your project that must be solved before u run it
but wile I'm trying to run
mvn spring-boot:run -Pdev
on my macbook, it's working and running
facing issue in windows machine
Then try to shorten the path
Never had this issue tho 🤔
Well you can run code even if tests fail.
What?
@ionic egret you're running into windows path length issues, can you share your pom file?
it's possible tht jdk installed is not suitable with spring boot
the guy says that on apple same code works
What?
There have been very few OS specific bugs.
What
Spring Boot 3.0 requires Java 17 as a minimum version
if they use lower version, they may have issues
i agree to share the pom file content so we know the setup
That is not OS related and would lead to a different issue.
but also, let us know about your installed JDK @ionic egret
it is
as long as jdk install is in os
I'm using JDK17
Where is your .m2 folder located?
C:\Users\Arundhati Hazra.m2
C:\Users\Arundhati Hazra\ .m2
can you do mvn -X spring-boot:run and check for forked process?
There are a couple of options, likely the easiest is moving your .m2 folder to the root if that pops something up. Given those dependenies you might be dragging something quite long in.
Alright
Try to do
./mvnw clean install -U
It seems u have some corrupted dependencies
If that doesn't solve it, then try to delete all dependencies in m2
Then retry
Also, is there a settings.xml file inside m2?
Do u have test classes in ur spring boot?
The error says spring context failed to load for testclass
I think that's the problem
There is no setting.xml file in that folder
No.
The reason that test fails is the same as why they can't run it.
Okay, what would be the solution
Still at work, I just had a short coffee break but just check what I asked earlier in regards to the classpath length.
What class path?
You didn't mentioned
#1275369200596291625 message
And below.
The .m2 recommendation is more likely to help.
But I have to return to work.
Okay let me try with -X
Okay
Can u do ./mvnw spring-boot:run -DskipTests
If the works with this command
That means the problem is only in tests
the issue is not a malformed test firas
it is bc the paths are too long
windows has a path limit of 255 characters
unless wide-paths are enabled
so if u happen to construct a file-path that is longer than that, windows says nope
Never saw this
Let me try
then id suggest u step back and let the people who know about this issue handle the situation
🙂
u can see it being reported clearly here: https://i.imgur.com/BXgYeEB.png
Same
so maven failed to launch the entire setup as something in the chain of actions is too long for windows
so we have to find the something
So there must be solution for that
helpers suspected something in the pom and especially the .m2 where it would load external deps from
especially .m2 can easily create very long paths with deeply nested dependencies
for example, if ur .m2 is installed in a path that is already a bit longer, lets say C:/Users/John/Foo/Bar/Baz/Bblabla/.m2 and then u have a dependency in there with a long name, lets say
It's not looks so long
Hmm it's possible that a directory name with space between like "my directory" may behind this?
com/spring/boot/foo/bar/baz/
then the entire path to down there is very long:
C:/Users/John/Foo/Bar/Baz/Bblabla/.m2/com/spring/boot/foo/bar/baz/
and can easily outrun windows limit of 255 characters
in which case it all breaks
But it's short
well, ur name isnt that short to be fair
This is the play where m2 file located
there could be other offenders than just m2 though
it was just one (common) source for this
So what should I do
to make sure its not the m2, u could move it to a top level directory instead
such as C:/.m2
that would give u like 30 more characters room
otherwise u can also try to enable windows wide-path mode
or continue searching for other offenders in ur maven setup
also, are u sure the actual path is short?
it seems like ur launching from mingw
Just moved that folder to c:/ ?
so if its virtual filesystem is somewhere deeper down the file paths, the actual file path on ur windows system would be very long
like, mingws /d/surely-insurance-core/partner might actually be C:/Users/John/Foo/bar/Baz/Boo/baba/blabla/blabla/mingw/deepdown/filesystem/d/surely-insurance-core/partner
if u get what i mean
u would also have to adjust ur maven settings
u cant just move the folder around and expect it to find it still
That's literally the first thing I said here.
* Move .m2 repository to c:\
* Open settings.xml from %MAVEN_HOME%/conf and look for \<settings>.\<localRepository>(uncomment it if its commented out already) and change its value to c:/.m2/repository
* Save the file and run the build again
But it has no setting.xml file in that m2 folder
settings.xml from %MAVEN_HOME%/conf
ur looking in the wrong folder
btw, here is how to hack windows to accept longer file paths as well: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
Speaking from experience, that still has its quirks, but it's indeed a nice start.
I already did that
It's not working
okay. then try the m2 thing instead
Now let me try this
👍
Is it correct?
What path should I change
I have to command out these lines, right?
Uncomment it, and change the path value (the one currently saying path to local).
Okay?
Yes.
still same error?
And you restarted your computer right?
did u try to delete all ur maven dependencies in m2 ?
i mean: i didn't see such issue on windows during years
Yes
Mee too
Just facing these
tht's why i doubt it's cuz of os
can u send the logs please ?
i mean copy/paste not all of it
just the last 10 lines
also, i'd suggest u to create a second springboot project with https://start.spring.io/
without any dependency
and try to install and run it locally
in order to be certain that it's general issue on ur machine
Okay will try
Any more suggestions
the problem is
in this "Program Files"
that space causes the issue
do u use a maven wrapper? ?
Yes tried wrapper, but it didn't worked
in my end, when use same command as u , i dnt see that path to jdk
eh? did you actually read the error?
The wrapper works just fine with spaces...
have you tried running with the longClasspath flag set to true?
seems like you can edit it within GP
@ionic egret
I've noticed bad things happen when you have a space in your user name on windows. Arguments get split on that space character and shift the argument list. You have to turn on the most explicit logging.
Or try wsl
I see you're running it from intellij, what you can also try is within your run configuration check shorten command line and then select the apt value in your configuration.
its not an issue with maven. they use quotes for their command, so spaces are fine
Okay I will try tomorrow, today it's too late here at india
Okay I will check
Thank you guys