GenerateSourcesMojo extends AbstractMojo { static String loadDefaultConfigGenVersion() throws MojoExecutionException { Properties props = new Properties(); try { props.load(GenerateSourcesMojo.class.getResourceAsStream("/build.properties")); } catch (IOException e) { throw new MojoExecutionException("Failed to resolve version of com.yahoo.vespa:config-class-plugin.", new FileNotFoundException("/build.properties")); } return props.getProperty("projectVersion"); }  @Override void execute();  }
@Test public void requireThatDefaultConfigGenVersionIsLoadedFromBuildProperties() throws MojoExecutionException { String expected = System.getProperty("expectedDefaultConfigGenVersion"); System.out.println("expectedDefaultConfigGenVersion = " + expected); assumeNotNull(expected); String actual = GenerateSourcesMojo.loadDefaultConfigGenVersion(); System.out.println("defaultConfigGenVersion = " + actual); assertEquals(expected, actual); }