Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dream21st
jenkins
提交
cd968ce2
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,发现更多精彩内容 >>
提交
cd968ce2
编写于
9月 07, 2011
作者:
I
imod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
integrate m2extra-steps into maven-plugin
上级
9a48907a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
181 addition
and
13 deletion
+181
-13
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
+55
-6
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+73
-6
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
...urces/hudson/maven/MavenModuleSet/configure-entries.jelly
+43
-0
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.properties
.../hudson/maven/MavenModuleSet/configure-entries.properties
+5
-1
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_fr.properties
...dson/maven/MavenModuleSet/configure-entries_fr.properties
+5
-0
未找到文件。
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
浏览文件 @
cd968ce2
...
...
@@ -38,12 +38,11 @@ import hudson.maven.settings.MavenSettingsProvider;
import
hudson.model.AbstractProject
;
import
hudson.model.Action
;
import
hudson.model.BuildableItemWithBuildWrappers
;
import
hudson.tasks.Builder
;
import
hudson.model.DependencyGraph
;
import
hudson.model.Descriptor
;
import
hudson.model.Descriptor.FormException
;
import
hudson.model.Executor
;
import
hudson.model.TaskListener
;
import
jenkins.model.Jenkins
;
import
hudson.model.Item
;
import
hudson.model.ItemGroup
;
import
hudson.model.Job
;
...
...
@@ -52,6 +51,7 @@ import hudson.model.Queue.Task;
import
hudson.model.ResourceActivity
;
import
hudson.model.SCMedItem
;
import
hudson.model.Saveable
;
import
hudson.model.TaskListener
;
import
hudson.model.TopLevelItem
;
import
hudson.search.CollectionSearchIndex
;
import
hudson.search.SearchIndexBuilder
;
...
...
@@ -87,6 +87,7 @@ import java.util.Stack;
import
javax.servlet.ServletException
;
import
jenkins.model.Jenkins
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.lang.math.NumberUtils
;
...
...
@@ -111,6 +112,8 @@ import org.kohsuke.stapler.export.Exported;
* @author Kohsuke Kawaguchi
*/
public
class
MavenModuleSet
extends
AbstractMavenProject
<
MavenModuleSet
,
MavenModuleSetBuild
>
implements
TopLevelItem
,
ItemGroup
<
MavenModule
>,
SCMedItem
,
Saveable
,
BuildableItemWithBuildWrappers
{
/**
* All {@link MavenModule}s, keyed by their {@link MavenModule#getModuleName()} module name}s.
*/
...
...
@@ -254,6 +257,18 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
private
DescribableList
<
BuildWrapper
,
Descriptor
<
BuildWrapper
>>
buildWrappers
=
new
DescribableList
<
BuildWrapper
,
Descriptor
<
BuildWrapper
>>(
this
);
/**
* List of active {@link Builder}s configured for this project.
*/
private
DescribableList
<
Builder
,
Descriptor
<
Builder
>>
prebuilders
=
new
DescribableList
<
Builder
,
Descriptor
<
Builder
>>(
this
);
private
DescribableList
<
Builder
,
Descriptor
<
Builder
>>
postbuilders
=
new
DescribableList
<
Builder
,
Descriptor
<
Builder
>>(
this
);
private
String
runPostStepsIfResult
;
/**
* @deprecated
* Use {@link #MavenModuleSet(ItemGroup, String)}
...
...
@@ -266,6 +281,21 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
super
(
parent
,
name
);
}
public
List
<
Builder
>
getPrebuilders
()
{
return
prebuilders
.
toList
();
}
public
List
<
Builder
>
getPostbuilders
()
{
return
postbuilders
.
toList
();
}
/**
* @return Returns the runIfResult value.
*/
public
String
getRunPostStepsIfResult
()
{
return
runPostStepsIfResult
;
}
public
String
getUrlChildPrefix
()
{
// seemingly redundant "./" is used to make sure that ':' is not interpreted as the scheme identifier
return
"."
;
...
...
@@ -595,16 +625,27 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
this
.
sortedActiveModules
=
getDisabledModules
(
false
);
}
if
(
reporters
==
null
)
if
(
reporters
==
null
)
{
reporters
=
new
DescribableList
<
MavenReporter
,
Descriptor
<
MavenReporter
>>(
this
);
}
reporters
.
setOwner
(
this
);
if
(
publishers
==
null
)
if
(
publishers
==
null
)
{
publishers
=
new
DescribableList
<
Publisher
,
Descriptor
<
Publisher
>>(
this
);
}
publishers
.
setOwner
(
this
);
if
(
buildWrappers
==
null
)
if
(
buildWrappers
==
null
)
{
buildWrappers
=
new
DescribableList
<
BuildWrapper
,
Descriptor
<
BuildWrapper
>>(
this
);
}
buildWrappers
.
setOwner
(
this
);
if
(
prebuilders
==
null
){
prebuilders
=
new
DescribableList
<
Builder
,
Descriptor
<
Builder
>>(
this
);
}
prebuilders
.
setOwner
(
this
);
if
(
postbuilders
==
null
){
postbuilders
=
new
DescribableList
<
Builder
,
Descriptor
<
Builder
>>(
this
);
}
postbuilders
.
setOwner
(
this
);
updateTransientActions
();
}
...
...
@@ -660,6 +701,8 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
publishers
.
buildDependencyGraph
(
this
,
graph
);
buildWrappers
.
buildDependencyGraph
(
this
,
graph
);
prebuilders
.
buildDependencyGraph
(
this
,
graph
);
postbuilders
.
buildDependencyGraph
(
this
,
graph
);
}
public
MavenModule
getRootModule
()
{
...
...
@@ -678,6 +721,8 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
activities
.
addAll
(
super
.
getResourceActivities
());
activities
.
addAll
(
Util
.
filter
(
publishers
,
ResourceActivity
.
class
));
activities
.
addAll
(
Util
.
filter
(
buildWrappers
,
ResourceActivity
.
class
));
activities
.
addAll
(
Util
.
filter
(
prebuilders
,
ResourceActivity
.
class
));
activities
.
addAll
(
Util
.
filter
(
postbuilders
,
ResourceActivity
.
class
));
return
activities
;
}
...
...
@@ -935,6 +980,10 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
buildWrappers
.
rebuild
(
req
,
json
,
BuildWrappers
.
getFor
(
this
));
settingConfigId
=
req
.
getParameter
(
"maven.mavenSettingsConfigId"
);
globalSettingConfigId
=
req
.
getParameter
(
"maven.mavenGlobalSettingConfigId"
);
runPostStepsIfResult
=
req
.
getParameter
(
"post-steps.runIfResult"
);
prebuilders
.
rebuildHetero
(
req
,
json
,
Builder
.
all
(),
"prebuilder"
);
postbuilders
.
rebuildHetero
(
req
,
json
,
Builder
.
all
(),
"postbuilder"
);
}
/**
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
cd968ce2
...
...
@@ -47,7 +47,6 @@ import hudson.model.Computer;
import
hudson.model.Environment
;
import
hudson.model.Executor
;
import
hudson.model.Fingerprint
;
import
jenkins.model.Jenkins
;
import
hudson.model.ParameterDefinition
;
import
hudson.model.ParametersAction
;
import
hudson.model.ParametersDefinitionProperty
;
...
...
@@ -58,6 +57,7 @@ import hudson.model.TaskListener;
import
hudson.remoting.Channel
;
import
hudson.remoting.VirtualChannel
;
import
hudson.scm.ChangeLogSet
;
import
hudson.tasks.BuildStep
;
import
hudson.tasks.BuildWrapper
;
import
hudson.tasks.MailSender
;
import
hudson.tasks.Maven.MavenInstallation
;
...
...
@@ -71,6 +71,7 @@ import java.io.IOException;
import
java.io.InterruptedIOException
;
import
java.io.PrintStream
;
import
java.io.Serializable
;
import
java.text.MessageFormat
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
...
...
@@ -85,6 +86,8 @@ import java.util.Set;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
jenkins.model.Jenkins
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.maven.BuildFailureException
;
...
...
@@ -123,6 +126,7 @@ import org.sonatype.aether.transfer.TransferListener;
* @author Kohsuke Kawaguchi
*/
public
class
MavenModuleSetBuild
extends
AbstractMavenBuild
<
MavenModuleSet
,
MavenModuleSetBuild
>
{
/**
* {@link MavenReporter}s that will contribute project actions.
* Can be null if there's none.
...
...
@@ -555,12 +559,13 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
private
Map
<
ModuleName
,
MavenBuild
.
ProxyImpl2
>
proxies
;
protected
Result
doRun
(
final
BuildListener
listener
)
throws
Exception
{
PrintStream
logger
=
listener
.
getLogger
();
Result
r
=
null
;
Result
r
=
null
;
PrintStream
logger
=
listener
.
getLogger
();
FilePath
remoteSettings
=
null
,
remoteGlobalSettings
=
null
;
try
{
EnvVars
envVars
=
getEnvironment
(
listener
);
MavenInstallation
mvn
=
project
.
getMaven
();
if
(
mvn
==
null
)
...
...
@@ -586,6 +591,17 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
else
{
// do builds here
try
{
// run pre build steps
if
(!
preBuild
(
listener
,
project
.
getPrebuilders
())){
r
=
FAILURE
;
return
r
;
}
if
(!
build
(
listener
,
project
.
getPrebuilders
())){
r
=
FAILURE
;
return
r
;
}
List
<
BuildWrapper
>
wrappers
=
new
ArrayList
<
BuildWrapper
>();
for
(
BuildWrapper
w
:
project
.
getBuildWrappersList
())
wrappers
.
add
(
w
);
...
...
@@ -601,8 +617,10 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
e
.
buildEnvVars
(
envVars
);
// #3502: too late for getEnvironment to do this
}
if
(!
preBuild
(
listener
,
project
.
getPublishers
()))
return
Result
.
FAILURE
;
if
(!
preBuild
(
listener
,
project
.
getPublishers
())){
r
=
FAILURE
;
return
r
;
}
String
settingsConfigId
=
project
.
getSettingConfigId
();
...
...
@@ -779,6 +797,20 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
r
=
Executor
.
currentExecutor
().
abortResult
();
throw
e
;
}
finally
{
// only run post build steps if requested...
if
(
shouldPostStepsRun
(
r
,
project
.
getRunPostStepsIfResult
())){
boolean
proceedPostSteps
=
true
;
if
(!
preBuild
(
listener
,
project
.
getPostbuilders
())){
r
=
FAILURE
;
proceedPostSteps
=
false
;
}
if
(
proceedPostSteps
){
if
(!
build
(
listener
,
project
.
getPostbuilders
())){
r
=
FAILURE
;
}
}
}
if
(
r
!=
null
)
{
setResult
(
r
);
}
...
...
@@ -794,6 +826,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
return
r
;
}
catch
(
AbortException
e
)
{
if
(
e
.
getMessage
()!=
null
)
...
...
@@ -830,6 +863,40 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
private
boolean
build
(
BuildListener
listener
,
Collection
<
hudson
.
tasks
.
Builder
>
steps
)
throws
IOException
,
InterruptedException
{
for
(
BuildStep
bs
:
steps
){
if
(!
perform
(
bs
,
listener
))
{
LOGGER
.
fine
(
MessageFormat
.
format
(
"{1} failed"
,
bs
));
return
false
;
}
}
return
true
;
}
private
boolean
shouldPostStepsRun
(
Result
buildResult
,
String
runIfResult
)
{
// If runIfResult is null, set it to "allCases".
if
(
runIfResult
==
null
)
{
runIfResult
=
"allCases"
;
}
// If runIfResult is "allCases", we're running regardless.
if
(
runIfResult
.
equals
(
"allCases"
))
{
return
true
;
}
else
{
// Otherwise, we're going to need to compare against the build result.
if
(
runIfResult
.
equals
(
"success"
))
{
return
((
buildResult
==
null
)
||
(
buildResult
.
isBetterOrEqualTo
(
Result
.
SUCCESS
)));
}
else
if
(
runIfResult
.
equals
(
"unstable"
))
{
return
((
buildResult
==
null
)
||
(
buildResult
.
isBetterOrEqualTo
(
Result
.
UNSTABLE
)));
}
}
// If we get down here, something weird's going on. Return false.
return
false
;
}
/**
* Returns the modules which have not been build since the last successful aggregator build
* though they should be because they had SCM changes.
...
...
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
浏览文件 @
cd968ce2
...
...
@@ -38,6 +38,15 @@ THE SOFTWARE.
<p:config-upstream-pseudo-trigger />
</p:config-trigger>
<f:section title="${%Pre Steps}">
<f:block>
<f:hetero-list name="prebuilder" hasHeader="true"
descriptors="${h.getBuilderDescriptors(it)}"
items="${it.prebuilders}"
addCaption="${%Add pre-build step}"/>
</f:block>
</f:section>
<f:section title="${%Build}">
<j:set var="mavens" value="${it.descriptor.mavenDescriptor.installations}" />
<j:if test="${empty(mavens)}">
...
...
@@ -129,6 +138,39 @@ THE SOFTWARE.
</f:advanced>
</f:section>
<f:section title="${%Post Steps}">
<f:entry description="${%criteriaDescription}">
<f:radio name="post-steps.runIfResult" value="success" checked="${instance.runPostStepsIfResult =='success'}" />
<st:nbsp />
<label class="attach-previous">${%runIfStable}</label>
<st:nbsp />
<f:radio name="post-steps.runIfResult" value="unstable" checked="${instance.runPostStepsIfResult =='unstable'}" />
<st:nbsp />
<label class="attach-previous">${%runIfSuccessful}</label>
<st:nbsp />
<j:if test="${instance != null}">
<j:if test="${instance.runPostStepsIfResult == null}">
<f:radio name="post-steps.runIfResult" value="allCases" checked="${true}" />
</j:if>
<j:if test="${instance.runPostStepsIfResult != null}">
<f:radio name="post-steps.runIfResult" value="allCases" checked="${instance.runPostStepsIfResult =='allCases'}" />
</j:if>
</j:if>
<j:if test="${instance == null}">
<f:radio name="post-steps.runIfResult" value="allCases" checked="${true}" />
</j:if>
<st:nbsp />
<label class="attach-previous">${%runAlways}</label>
<st:nbsp />
</f:entry>
<f:block>
<f:hetero-list name="postbuilder" hasHeader="true"
descriptors="${h.getBuilderDescriptors(it)}"
items="${it.postbuilders}"
addCaption="${%Add post-build step}"/>
</f:block>
</f:section>
<j:invokeStatic var="reporters" className="hudson.maven.MavenReporters" method="getConfigurableList" />
<j:if test="${!empty(reporters)}">
<f:descriptorList title="${%Build Settings}"
...
...
@@ -136,6 +178,7 @@ THE SOFTWARE.
instances="${it.reporters.toMap()}" />
</j:if>
<p:config-buildWrappers />
<p:config-publishers />
</j:jelly>
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.properties
浏览文件 @
cd968ce2
...
...
@@ -21,4 +21,8 @@
# THE SOFTWARE.
Maven\
Version.error.1
=
Jenkins needs to know where your Maven2 is installed.
Maven\
Version.error.2
=
Please do so from <a href="{0}/configure" target="_new">the system configuration</a>.
\ No newline at end of file
Maven\
Version.error.2
=
Please do so from <a href="{0}/configure" target="_new">the system configuration</a>.
criteriaDescription
=
Should the post-build steps run only for successful builds, etc.
runIfStable
=
Run only if build succeeds
runIfSuccessful
=
Run only if build succeeds or is unstable
runAlways
=
Run regardless of build result
\ No newline at end of file
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries_fr.properties
浏览文件 @
cd968ce2
...
...
@@ -40,3 +40,8 @@ Resolve\ Dependencies\ during\ Pom\ parsing=Effectue la r\u00e9solution de d\u00
Process\
Plugins\
during\
Pom\
parsing
=
Analyse les plugins pendant la lecture du POM
Maven\
Validation\
Level
=
Niveau de validation du POM Maven
Goals
=
Goals
Add\
post-build\
step
=
Ajouter une
\u
00E9tape pr
\u
00E9-build
Add\
pre-build\
step
=
Ajouter une
\u
00E9tape pr
\u
00E9-build
Post-Build\
Run\
Criteria
=
Crit
\u
00E8re pour ex
\u
00E9cuter le post-build
Steps\
to\
run\
after\
mvn\
build
=
\u
00C9tapes
\u
00E0 lancer apr
\u
00E8s le build maven
Steps\
to\
run\
before\
mvn\
build
=
\u
00C9tapes
\u
00E0 lancer avant le build maven
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录