public static String determinePluginVersion ( ) { if ( pluginVersion == null ) { final String fileName = "META-INF/gradle-plugins/thorntail.properties" ; ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; String version ; try ( InputStream stream = loader . getResourceAsStream ( fileName ) ) { Properties props = new Properties ( ) ; props . load ( stream ) ; version = props . getProperty ( "implementation-version" ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Unable to locate file: " + fileName , e ) ; } pluginVersion = version ; } return pluginVersion ; }
Parse the plugin definition file and extract the version details from it .