Skip to content

Don't create javac.[sh|bat] or org.codehaus.plexus.compiler.javac.JavacCompiler*arguments in target/*classes #165

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

Closed
zregvart opened this issue Nov 11, 2021 · 2 comments · Fixed by #184

Comments

@zregvart
Copy link
Contributor

When debug logging is turned on Javac Plexus compiler creates two additional files in target/classes or target/test-classes. These files will be also included in the built artifact, say a JAR file.

This is done here:

File commandLineFile =
new File( config.getOutputLocation(), "javac." + ( Os.isFamily( Os.FAMILY_WINDOWS ) ? "bat" : "sh" ) );

And here:

tempFile =
File.createTempFile( JavacCompiler.class.getName(), "arguments", new File( outputDirectory ) );

Seems that the calls to config.getOutputLocation() need to be replaced with config.getBuildDirectory() in those two instances.

@urld
Copy link

urld commented Dec 17, 2021

I second that. I would expect the same resulting package regardless of whether debugging is enabled or not.
Leaving those files in target/classes can also causes build failures in debug mode when maven-duplicate-finder-plugin is used.

zregvart added a commit to zregvart/plexus-compiler that referenced this issue Dec 17, 2021
With this the arguments and `java.[sh|bat` files will be created in the
build directory (usually `target`), rather than in the output directory
(usually `target/classes`).

Fixes codehaus-plexus#165
@zregvart
Copy link
Contributor Author

Thanks for resurrecting this discussion @urld, I've proposed a change in #173 that I think will fix this issue. Feedback welcome!

zregvart added a commit to zregvart/plexus-compiler that referenced this issue Dec 17, 2021
With this the arguments and `java.[sh|bat` files will be created in the
build directory (usually `target`), rather than in the output directory
(usually `target/classes`).

Fixes codehaus-plexus#165
zregvart added a commit to zregvart/plexus-compiler that referenced this issue Dec 17, 2021
With this the arguments and `java.[sh|bat` files will be created in the
build directory (usually `target`), rather than in the output directory
(usually `target/classes`).

Fixes codehaus-plexus#165
@olamy olamy closed this as completed in #184 Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment