Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dream21st
jenkins
提交
f110fd4e
J
jenkins
项目概览
dream21st
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f110fd4e
编写于
11月 06, 2012
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #608 from Vlatombe/improve-failsafe-support
Refactor handling of test mojos Thanks
上级
90052754
30927247
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
29 deletion
+30
-29
changelog.html
changelog.html
+2
-1
maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
...rc/main/java/hudson/maven/reporters/SurefireArchiver.java
+28
-28
未找到文件。
changelog.html
浏览文件 @
f110fd4e
...
@@ -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=-->
...
...
maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
浏览文件 @
f110fd4e
...
@@ -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
(!
is
SurefireTest
(
mojo
))
return
true
;
if
(!
is
TestMojo
(
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
is
SurefireTest
(
MojoInfo
mojo
)
{
private
boolean
is
TestMojo
(
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录