davidB / scala-maven-plugin

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
https://davidb.github.io/scala-maven-plugin/
The Unlicense
560 stars 151 forks source link

Fix JavaLocator, close #619 #623

Closed slandelle closed 2 years ago

slandelle commented 2 years ago

Motivation:

  1. We should prefer the Java installation used to run maven to what's defined in JAVA_HOME
  2. We should prefer JDK over JRE (for old versions that used to have one) as we need javac for compiling Java code in mixed projects

Modifications:

Resolve with the following chain:

Result:

Behavior consistent with maven-compiler-plugin and org.codehaus.plexus.compiler.javac.JavacCompiler#getJavacExecutable.

In particular:

slandelle commented 2 years ago

@roti Could you please give this branch a try?

slandelle commented 2 years ago

Personaly, I prefer when there is only one return with result (maybe some into the guardian/pre-check section).

@davidB Honestly, I can't find a way with Java's poor tools for composability. Feel free to refactor if you have some nice ideas.

roti commented 2 years ago

@slandelle It works for me. Thanks.