Class JavaToolFinder


  • public class JavaToolFinder
    extends org.tentackle.common.ToolFinder
    Finds java tools to execute on behalf of a maven plugin.
    • 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 File find​(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)