Lines 62-67
Link Here
|
62 |
import org.apache.maven.project.MavenProject; |
62 |
import org.apache.maven.project.MavenProject; |
63 |
import org.apache.maven.artifact.Artifact; |
63 |
import org.apache.maven.artifact.Artifact; |
64 |
import org.apache.maven.artifact.versioning.ComparableVersion; |
64 |
import org.apache.maven.artifact.versioning.ComparableVersion; |
|
|
65 |
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; |
65 |
import org.codehaus.plexus.util.FileUtils; |
66 |
import org.codehaus.plexus.util.FileUtils; |
66 |
import org.codehaus.plexus.util.StringUtils; |
67 |
import org.codehaus.plexus.util.StringUtils; |
67 |
import org.jdom.Document; |
68 |
import org.jdom.Document; |
Lines 266-271
Link Here
|
266 |
|
267 |
|
267 |
public @Override void sequenceStart(String sequenceId, OutputVisitor visitor) { |
268 |
public @Override void sequenceStart(String sequenceId, OutputVisitor visitor) { |
268 |
session = null; |
269 |
session = null; |
|
|
270 |
// Fix for #257563 / SUREFIRE-1158, where surefire 2.19.x |
271 |
// removed the printing of the output directory. Get the directory from |
272 |
// the configuration directly or fallback to the plugin standard |
273 |
if (usingSurefire219(this.config.getMavenProject())) { |
274 |
|
275 |
// http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#reportsDirectory |
276 |
String reportsDirectory = PluginPropertyUtils.getPluginProperty(config.getMavenProject(), |
277 |
Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE, "reportsDirectory", "test", null); // NOI18N |
278 |
if (null == reportsDirectory) { |
279 |
// fallback to default value |
280 |
try { |
281 |
Object defaultValue = PluginPropertyUtils.createEvaluator(config.getMavenProject()) |
282 |
.evaluate("${project.build.directory}/surefire-reports"); |
283 |
if (defaultValue instanceof String) { |
284 |
reportsDirectory = (String) defaultValue; |
285 |
} |
286 |
} catch (ExpressionEvaluationException ex) { |
287 |
// NOP could not resolved default value |
288 |
} |
289 |
} |
290 |
if (null != reportsDirectory) { |
291 |
|
292 |
File absoluteFile = new File(reportsDirectory); |
293 |
// configuration might be "target/directory", which is relative |
294 |
// to the maven project or an absolute path |
295 |
File relativeFile = new File(this.config.getMavenProject().getBasedir(), reportsDirectory); |
296 |
if (absoluteFile.exists() && absoluteFile.isDirectory()) { |
297 |
outputDir = absoluteFile; |
298 |
} else { |
299 |
if (relativeFile.exists() && relativeFile.isDirectory()) { |
300 |
outputDir = relativeFile; |
301 |
} |
302 |
} |
303 |
if (null != outputDir) { |
304 |
|
305 |
createSession(outputDir); |
306 |
} |
307 |
} |
308 |
} |
269 |
} |
309 |
} |
270 |
|
310 |
|
271 |
//#179703 allow multiple sessions per project, in case there are multiple executions of surefire plugin. |
311 |
//#179703 allow multiple sessions per project, in case there are multiple executions of surefire plugin. |
Lines 407-412
Link Here
|
407 |
} |
447 |
} |
408 |
} |
448 |
} |
409 |
|
449 |
|
|
|
450 |
private boolean usingSurefire219(MavenProject prj) { |
451 |
String v = PluginPropertyUtils.getPluginVersion(prj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE); |
452 |
return v != null && new ComparableVersion(v).compareTo(new ComparableVersion("2.19")) >= 0; |
453 |
} |
454 |
|
410 |
private boolean usingSurefire2121(MavenProject prj) { |
455 |
private boolean usingSurefire2121(MavenProject prj) { |
411 |
String v = PluginPropertyUtils.getPluginVersion(prj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE); |
456 |
String v = PluginPropertyUtils.getPluginVersion(prj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE); |
412 |
return v != null && new ComparableVersion(v).compareTo(new ComparableVersion("2.12.1")) >= 0; |
457 |
return v != null && new ComparableVersion(v).compareTo(new ComparableVersion("2.12.1")) >= 0; |