Class JavaToolFinder


  • public class JavaToolFinder
    extends org.tentackle.common.ToolFinder
    Finds java tools to execute on behalf of a maven plugin.
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaToolFinder()
      Creates a toolfinder without toolchain.
      JavaToolFinder​(org.apache.maven.toolchain.Toolchain toolchain)
      Creates the toolfinder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File find​(java.lang.String toolName)
      Finds the file of a java tool.
      • Methods inherited from class org.tentackle.common.ToolFinder

        loadTool
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JavaToolFinder

        public JavaToolFinder​(org.apache.maven.toolchain.Toolchain toolchain)
        Creates the toolfinder.
        Parameters:
        toolchain - the optional toolchain
      • JavaToolFinder

        public JavaToolFinder()
        Creates a toolfinder without toolchain.
    • Method Detail

      • find

        public java.io.File find​(java.lang.String toolName)
        Finds the file of a java tool.

        If the finder was created with JavaToolFinder(Toolchain), the toolchain is consulted first. Otherwise or if not found by the toolchain, it looks in the same directory where the current command (usually java) is located. This is safe for all JDK tools, whether JAVA_HOME or PATH is configured correctly or not.
        If not found, the environment JAVA_HOME ist tried.
        If still not found, the environment's PATH variable is consulted.

        Depending on the OS, it will also try to append well-known suffixes to the toolName. Windows: ".exe", ".cmd" and ".bat". Others (Unixes): ".sh".

        Overrides:
        find in class org.tentackle.common.ToolFinder
        Parameters:
        toolName - the platform independent tool name
        Returns:
        file representing the tool's executable, or null if the tool can not be found
        See Also:
        ToolFinder.find(String)