Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
9519de18
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
9519de18
编写于
11月 23, 2011
作者:
I
imod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
additionaly pass reference to current build to intercepting methods
上级
fda6daa0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
7 deletion
+13
-7
maven-plugin/src/main/java/hudson/maven/MavenArgumentInterceptorAction.java
...ain/java/hudson/maven/MavenArgumentInterceptorAction.java
+9
-3
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+2
-2
test/src/test/java/hudson/maven/MavenArgumentInterceptorTest.java
.../test/java/hudson/maven/MavenArgumentInterceptorTest.java
+2
-2
未找到文件。
maven-plugin/src/main/java/hudson/maven/MavenArgumentInterceptorAction.java
浏览文件 @
9519de18
...
@@ -45,16 +45,19 @@ public interface MavenArgumentInterceptorAction extends Action {
...
@@ -45,16 +45,19 @@ public interface MavenArgumentInterceptorAction extends Action {
* This method will be called on one and only one action during a build. If
* This method will be called on one and only one action during a build. If
* there are two actions present in the build, the second will be ignored.
* there are two actions present in the build, the second will be ignored.
*
*
* @param build
* reference to the current build, might be used for some
* calculations for the correct arguments
* @return the maven goals and options to start maven with. Result is
* @return the maven goals and options to start maven with. Result is
* ignored if <code>null</code> or empty. Variables will be expanded
* ignored if <code>null</code> or empty. Variables will be expanded
* by the caller.
* by the caller.
*/
*/
public
String
getGoalsAndOptions
();
public
String
getGoalsAndOptions
(
MavenModuleSetBuild
build
);
/**
/**
* Change/add arguments to any needs, but special care has to be taken, as
* Change/add arguments to any needs, but special care has to be taken, as
* the list contains every argument needed for the default execution (e.g.
* the list contains every argument needed for the default execution (e.g.
*
-f /path/to/pom.xml or -B
). <br />
*
<code>-f /path/to/pom.xml</code> or <code>-B</code>
). <br />
* An easy example would be to add "<code>-DskipTests</code>" to skip the
* An easy example would be to add "<code>-DskipTests</code>" to skip the
* test execution on request.
* test execution on request.
*
*
...
@@ -66,8 +69,11 @@ public interface MavenArgumentInterceptorAction extends Action {
...
@@ -66,8 +69,11 @@ public interface MavenArgumentInterceptorAction extends Action {
* @param mavenargs
* @param mavenargs
* the calculated default maven arguments (never
* the calculated default maven arguments (never
* <code>null</code>).
* <code>null</code>).
* @param build
* reference to the current build, might be used for some
* calculations for the correct arguments
* @return the new arguments to be used.
* @return the new arguments to be used.
*/
*/
public
ArgumentListBuilder
intercept
(
ArgumentListBuilder
mavenargs
);
public
ArgumentListBuilder
intercept
(
ArgumentListBuilder
mavenargs
,
MavenModuleSetBuild
build
);
}
}
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
9519de18
...
@@ -760,7 +760,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -760,7 +760,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
// find the correct maven goals and options, there might by an action overruling the defaults
// find the correct maven goals and options, there might by an action overruling the defaults
String
goals
=
project
.
getGoals
();
// default
String
goals
=
project
.
getGoals
();
// default
for
(
MavenArgumentInterceptorAction
mavenArgInterceptor
:
argInterceptors
)
{
for
(
MavenArgumentInterceptorAction
mavenArgInterceptor
:
argInterceptors
)
{
final
String
goalsAndOptions
=
mavenArgInterceptor
.
getGoalsAndOptions
();
final
String
goalsAndOptions
=
mavenArgInterceptor
.
getGoalsAndOptions
(
this
.
getBuild
()
);
if
(
StringUtils
.
isNotBlank
(
goalsAndOptions
)){
if
(
StringUtils
.
isNotBlank
(
goalsAndOptions
)){
goals
=
goalsAndOptions
;
goals
=
goalsAndOptions
;
// only one interceptor is allowed to overwrite the whole "goals and options" string
// only one interceptor is allowed to overwrite the whole "goals and options" string
...
@@ -772,7 +772,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -772,7 +772,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
// enable the interceptors to change the whole command argument list
// enable the interceptors to change the whole command argument list
// all available interceptors are allowed to modify the argument list
// all available interceptors are allowed to modify the argument list
for
(
MavenArgumentInterceptorAction
mavenArgInterceptor
:
argInterceptors
)
{
for
(
MavenArgumentInterceptorAction
mavenArgInterceptor
:
argInterceptors
)
{
final
ArgumentListBuilder
newMargs
=
mavenArgInterceptor
.
intercept
(
margs
);
final
ArgumentListBuilder
newMargs
=
mavenArgInterceptor
.
intercept
(
margs
,
this
.
getBuild
()
);
if
(
newMargs
!=
null
)
{
if
(
newMargs
!=
null
)
{
margs
=
newMargs
;
margs
=
newMargs
;
}
}
...
...
test/src/test/java/hudson/maven/MavenArgumentInterceptorTest.java
浏览文件 @
9519de18
...
@@ -105,11 +105,11 @@ public class MavenArgumentInterceptorTest extends HudsonTestCase {
...
@@ -105,11 +105,11 @@ public class MavenArgumentInterceptorTest extends HudsonTestCase {
return
null
;
return
null
;
}
}
public
String
getGoalsAndOptions
()
{
public
String
getGoalsAndOptions
(
MavenModuleSetBuild
build
)
{
return
goalsAndOptions
;
return
goalsAndOptions
;
}
}
public
ArgumentListBuilder
intercept
(
ArgumentListBuilder
mavenargs
)
{
public
ArgumentListBuilder
intercept
(
ArgumentListBuilder
mavenargs
,
MavenModuleSetBuild
build
)
{
if
(
args
!=
null
)
{
if
(
args
!=
null
)
{
for
(
String
arg
:
this
.
args
)
{
for
(
String
arg
:
this
.
args
)
{
mavenargs
.
add
(
arg
);
mavenargs
.
add
(
arg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录