提交 e4846732 编写于 作者: J Jesse Glick

Merge branch 'master' of github.com:jenkinsci/jenkins

...@@ -55,7 +55,8 @@ Upcoming changes</a> ...@@ -55,7 +55,8 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. --> <!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=--> <div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image> <ul class=image>
<li class=> <li class=rfe>
Support failsafe the same way as surefire in maven2 jobs
</ul> </ul>
</div><!--=TRUNK-END=--> </div><!--=TRUNK-END=-->
......
...@@ -74,10 +74,8 @@ public class SurefireArchiver extends MavenReporter { ...@@ -74,10 +74,8 @@ public class SurefireArchiver extends MavenReporter {
private transient ConcurrentMap<File, FileSet> fileSets = new ConcurrentHashMap<File,FileSet>(); private transient ConcurrentMap<File, FileSet> fileSets = new ConcurrentHashMap<File,FileSet>();
public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException { public boolean preExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener) throws InterruptedException, IOException {
if (isSurefireTest(mojo)) { if (isTestMojo(mojo)) {
if ((!mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test")) if (!isSoapUiMojo(mojo)) {
&& (!mojo.is("eviware", "maven-soapui-plugin", "test"))
&& (!mojo.is("eviware", "maven-soapui-pro-plugin", "test"))) {
// tell surefire:test to keep going even if there was a failure, // tell surefire:test to keep going even if there was a failure,
// so that we can record this as yellow. // so that we can record this as yellow.
// note that because of the way Maven works, just updating system property at this point is too late // note that because of the way Maven works, just updating system property at this point is too late
...@@ -103,13 +101,12 @@ public class SurefireArchiver extends MavenReporter { ...@@ -103,13 +101,12 @@ public class SurefireArchiver extends MavenReporter {
} }
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, final BuildListener listener, Throwable error) throws InterruptedException, IOException { public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, final BuildListener listener, Throwable error) throws InterruptedException, IOException {
if (!isSurefireTest(mojo)) return true; if (!isTestMojo(mojo)) return true;
listener.getLogger().println(Messages.SurefireArchiver_Recording()); listener.getLogger().println(Messages.SurefireArchiver_Recording());
File reportsDir; File reportsDir;
if (mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test") || if (isSurefireOrFailsafeMojo(mojo)) {
mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test")) {
try { try {
reportsDir = mojo.getConfigurationValue("reportsDirectory", File.class); reportsDir = mojo.getConfigurationValue("reportsDirectory", File.class);
} catch (ComponentConfigurationException e) { } catch (ComponentConfigurationException e) {
...@@ -233,23 +230,20 @@ public class SurefireArchiver extends MavenReporter { ...@@ -233,23 +230,20 @@ public class SurefireArchiver extends MavenReporter {
} }
} }
private boolean isSurefireTest(MojoInfo mojo) { private boolean isTestMojo(MojoInfo mojo) {
if ((!mojo.is("com.sun.maven", "maven-junit-plugin", "test")) if ((!mojo.is("com.sun.maven", "maven-junit-plugin", "test"))
&& (!mojo.is("org.sonatype.flexmojos", "flexmojos-maven-plugin", "test-run")) && (!mojo.is("org.sonatype.flexmojos", "flexmojos-maven-plugin", "test-run"))
&& (!mojo.is("org.eclipse.tycho", "tycho-surefire-plugin", "test")) && (!mojo.is("org.eclipse.tycho", "tycho-surefire-plugin", "test"))
&& (!mojo.is("org.sonatype.tycho", "maven-osgi-test-plugin", "test")) && (!mojo.is("org.sonatype.tycho", "maven-osgi-test-plugin", "test"))
&& (!mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test")) && (!mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test"))
&& (!mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test")) && (!isAndroidMojo(mojo))
&& (!mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test")) && (!isSurefireOrFailsafeMojo(mojo))
&& (!mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")) && (!isSoapUiMojo(mojo)))
&& (!mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test"))
&& (!mojo.is("eviware", "maven-soapui-plugin", "test"))
&& (!mojo.is("eviware", "maven-soapui-pro-plugin", "test")))
return false; return false;
try { try {
if (mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")) { if (isSurefireOrFailsafeMojo(mojo)) {
Boolean skip = mojo.getConfigurationValue("skip", Boolean.class); Boolean skip = mojo.getConfigurationValue("skip", Boolean.class);
if (((skip != null) && (skip))) { if (((skip != null) && (skip))) {
return false; return false;
} }
...@@ -292,12 +286,7 @@ public class SurefireArchiver extends MavenReporter { ...@@ -292,12 +286,7 @@ public class SurefireArchiver extends MavenReporter {
if (((skipTests != null) && (skipTests))) { if (((skipTests != null) && (skipTests))) {
return false; return false;
} }
} else if (mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test")) { } else if (isAndroidMojo(mojo)) {
Boolean skipTests = mojo.getConfigurationValue("skipTests", Boolean.class);
if (((skipTests != null) && (skipTests))) {
return false;
}
} else if (mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test")) {
if (mojo.pluginName.version.compareTo("3.0.0-alpha-6") < 0) { if (mojo.pluginName.version.compareTo("3.0.0-alpha-6") < 0) {
// Earlier versions do not support tests // Earlier versions do not support tests
return false; return false;
...@@ -310,12 +299,7 @@ public class SurefireArchiver extends MavenReporter { ...@@ -310,12 +299,7 @@ public class SurefireArchiver extends MavenReporter {
} else if (mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test") && mojo.pluginName.version.compareTo("1.2") < 0) { } else if (mojo.is("org.codehaus.mojo", "gwt-maven-plugin", "test") && mojo.pluginName.version.compareTo("1.2") < 0) {
// gwt-maven-plugin < 1.2 does not implement required Surefire option // gwt-maven-plugin < 1.2 does not implement required Surefire option
return false; return false;
} else if (mojo.is("eviware", "maven-soapui-plugin", "test")) { } else if (isSoapUiMojo(mojo)) {
Boolean skipTests = mojo.getConfigurationValue("skip", Boolean.class);
if (((skipTests != null) && (skipTests))) {
return false;
}
} else if (mojo.is("eviware", "maven-soapui-pro-plugin", "test")) {
Boolean skipTests = mojo.getConfigurationValue("skip", Boolean.class); Boolean skipTests = mojo.getConfigurationValue("skip", Boolean.class);
if (((skipTests != null) && (skipTests))) { if (((skipTests != null) && (skipTests))) {
return false; return false;
...@@ -327,6 +311,22 @@ public class SurefireArchiver extends MavenReporter { ...@@ -327,6 +311,22 @@ public class SurefireArchiver extends MavenReporter {
return true; return true;
} }
private boolean isAndroidMojo(MojoInfo mojo) {
return mojo.is("com.jayway.maven.plugins.android.generation2", "maven-android-plugin", "internal-integration-test")
|| mojo.is("com.jayway.maven.plugins.android.generation2", "android-maven-plugin", "internal-integration-test");
}
private boolean isSurefireOrFailsafeMojo(MojoInfo mojo) {
return mojo.is("org.apache.maven.plugins", "maven-surefire-plugin", "test")
|| mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test")
|| mojo.is("org.apache.maven.plugins", "maven-failsafe-plugin", "verify");
}
private boolean isSoapUiMojo(MojoInfo mojo) {
return mojo.is("eviware", "maven-soapui-plugin", "test")
|| mojo.is("eviware", "maven-soapui-pro-plugin", "test");
}
// I'm not sure if SurefireArchiver is actually ever (de-)serialized, // I'm not sure if SurefireArchiver is actually ever (de-)serialized,
// but just to be sure, set fileSets here // but just to be sure, set fileSets here
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册