private File findConfiguredToolPath( String toolName, File pomValue, String prop, String envvar )
    {
        String systemPropertyValue = System.getProperty( prop );
        if ( systemPropertyValue != null && !systemPropertyValue.isEmpty() )
        {
            getLog().debug( toolName + " found in " + prop + " system property" );
            return new File( systemPropertyValue );
        }

        // No system property, we'll use the pom configured value if provided
        File result = pomValue;
        
        if ( result == null )
        {
            // Try project property ...
            String projectPropertyValue = mavenProject.getProperties().getProperty( prop );
            if ( projectPropertyValue != null && !projectPropertyValue.isEmpty() )
            {            
                getLog().debug( toolName + " found in " + prop + " property" );
                result = new File( projectPropertyValue );
            }
            else
            {
                // Try environment variable ...
                String envValue = System.getenv( envvar );
                if ( envValue != null && !envValue.isEmpty() )
                {
                    getLog().debug( toolName + " found in environment variable " + envvar );
                    result = new File( envValue );
                }
            }
        }        
        
        return result;
    }
private File findConfiguredToolPath ( String toolName , File pomValue , String prop , String envvar ) { String systemPropertyValue = System . getProperty ( prop ) ; if ( systemPropertyValue != null && ! systemPropertyValue . isEmpty ( ) ) { getLog ( ) . debug ( toolName + " found in " + prop + " system property" ) ; return new File ( systemPropertyValue ) ; } File result = pomValue ; if ( result == null ) { String projectPropertyValue = mavenProject . getProperties ( ) . getProperty ( prop ) ; if ( projectPropertyValue != null && ! projectPropertyValue . isEmpty ( ) ) { getLog ( ) . debug ( toolName + " found in " + prop + " property" ) ; result = new File ( projectPropertyValue ) ; } else { String envValue = System . getenv ( envvar ) ; if ( envValue != null && ! envValue . isEmpty ( ) ) { getLog ( ) . debug ( toolName + " found in environment variable " + envvar ) ; result = new File ( envValue ) ; } } } return result ; }
Find a configuration for the specified tool path.
The following precedence is observed: System property, POM value, Project property, Environment variable
@param toolName the name of the tool being sought, used for logging
@param pomValue the value found in the POM
@param prop the property name
@param envvar the environment variable name
@return the value determined or null if not found