Skip to content
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

Path too long on Windows fails to invoke AOT processing 'CreateProcess error=206, The filename or extension is too long' #44252

Open
neoludo opened this issue Feb 13, 2025 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@neoludo
Copy link

neoludo commented Feb 13, 2025

Hi,

I'm facing a problem while launching native tests, specifically in AOT Processing step.
Command line is too long (Yes, I'm under Windows... not my 1st choice)

Looking at CommandLineBuilder I'm quite surprise @Argfile is not used for the classpath. Is there a reason for that ?
Btw, how can I find a workaround to launch my build.

Thanks in advance for any help
Ludovic

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 13, 2025
@snicoll
Copy link
Member

snicoll commented Feb 13, 2025

Looking at CommandLineBuilder I'm quite surprise @Argfile is not used for the classpath. Is there a reason for that ?

No. I am aware this can be an issue but we've never faced it thus far.

Btw, how can I find a workaround to launch my build.

I have no idea. Restricting the number of dependencies or changing the location of your Maven repository (if you're using that) can be a workaround.

@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 13, 2025
@snicoll snicoll added this to the 3.3.9 milestone Feb 13, 2025
@snicoll snicoll changed the title spring-boot-maven-plugin:3.4.1:process-test-aot - CreateProcess error=206, The filename or extension is too long Path too long on Windows fails to invoke AOT processing 'CreateProcess error=206, The filename or extension is too long' Feb 13, 2025
@snicoll snicoll modified the milestones: 3.3.9, 3.3.x Feb 13, 2025
@neoludo
Copy link
Author

neoludo commented Feb 13, 2025

Suggestion

static String build(List<URL> classpathElements) {
	try {
		File classpathFile = File.createTempFile("classpath", ".txt");
		classpathFile.deleteOnExit();
		try (BufferedWriter writer = new BufferedWriter(new FileWriter(classpathFile))) {
			for (URL element : classpathElements) {
				writer.write(toFile(element).getAbsolutePath());
				writer.newLine();
			}
		}
		return "@" + classpathFile.getAbsolutePath();
	}
	catch (IOException ex) {
		throw new IllegalArgumentException("Failed to create classpath file", ex);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants