[This is a repost from maven-dev, which perhaps wasn't the right place for this question]

By default, Clover instruments tests to determine whether they succeed or fail, but Clover has an option to use the XML results of the tests instead.

I'm adding this capability to the maven-clover-plugin, and so I need to be able to determine where the surefire plugin has been configured to put its test results.

The code I'm using is below, and it has (at least) two deficiencies:

- the default value of the surefire reports directory is hard coded into the maven-clover-plugin - configuration value which include references to maven properties (e.g. ${project.build.directory}/my-surefire-reports) won't work, as the property won't be resolved.

Is there a better way to do this? Can I get the actual plugin out of plexus and get the real value of the property? If not, what's the best way of resolving properties in the config string?

Thanks for any advice,
 Tom

Plugin surefirePlugin = (Plugin) project .getBuild().getPluginsAsMap().get("org.apache.maven.plugins:maven- surefire-plugin");
           if (surefirePlugin == null)
           {
throw new MavenReportException("The surefire plugin is not installed, you can't set 'useSurefireTestResults' to true");
           }
File surefireReports = new File(project.getBuild().getDirectory() + File.separator + "surefire- reports"); // hard coded default location
           Object config = surefirePlugin.getConfiguration();
           if (config != null)
           {
String reportsDirectory = getNodeValue((Xpp3Dom) config, "reportsDirectory"); // this finds the value in <reportsDirectory>value</reportsDirectory>
               if (reportsDirectory != null)
               {
surefireReports = new File(reportsDirectory); // $ {foo} won't have been resolved
               }
           }
--
ATLASSIAN - http://www.atlassian.com
Our products help over 8,500 customers in more than 95 countries to collaborate






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to