Skip to content

Conversation

@glhez
Copy link
Contributor

@glhez glhez commented Feb 9, 2025

This fix the issue I had at work (#420) by ignoring the "Picked up" based on what the JDK outputs.

Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to simplify it, as example in issue.
so split output by lines and find first line starting with javac

@glhez
Copy link
Contributor Author

glhez commented Jun 21, 2025

I don't see what you means and I can't work on that now (PC broken and I don't want to mess with the one I use now).

The loop seems "difficult", but as far as I remember, I looked for the error message in JDK and calls here : https://github.com/openjdk/jdk/blob/81e43114eca5199a0d816c02f50ecb6bc370135b/src/hotspot/share/runtime/arguments.cpp#L3074

I am more or less doing a job of removing the line sent by parse_options_environment_variable.

Another alternative I did not try would be probably to remove the offending env variable which might or not requires a patch to https://codehaus-plexus.github.io (if that's the good repo) or avoid inheriting them.

@slawekjaranowski
Copy link
Member

Please look at:

maybe checking only standard output will be easier

@glhez
Copy link
Contributor Author

glhez commented Oct 28, 2025

Ok. javac -version output to stdout, java -version to stderr...

I fixed it to only read stdout like apache/maven-jar-plugin#471

@slachiewicz slachiewicz merged commit 739f5a8 into codehaus-plexus:master Nov 10, 2025
29 checks passed
@froque
Copy link

froque commented Nov 10, 2025

Ok. javac -version output to stdout, java -version to stderr...

This is not true for javac 1.8.0_472 and this fix will not work for this version. It outputs to stderr.

@slawekjaranowski
Copy link
Member

Ok. javac -version output to stdout, java -version to stderr...

This is not true for javac 1.8.0_472 and this fix will not work for this version. It outputs to stderr.

right ...

% javac -version 1>/dev/null      
javac 1.8.0_472

% javac -version 2>/dev/null
~ % 

@slawekjaranowski
Copy link
Member

next test - everything on stderr

JAVA_TOOL_OPTIONS="-Xms256m" javac -version 1>/dev/null
Picked up JAVA_TOOL_OPTIONS: -Xms256m
javac 1.8.0_472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavacCompiler fails to resolve version with maven toolchains and Jenkins

4 participants