Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
e14914e6
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
e14914e6
编写于
10月 03, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- moved MavenModuleSet.Builder to new top-level class Maven2Builder
- removed duplicated FilterImpl classes
上级
5acad66d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
221 addition
and
228 deletion
+221
-228
maven-plugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
...ugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
+37
-0
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
+180
-0
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
+2
-39
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+2
-189
未找到文件。
maven-plugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
浏览文件 @
e14914e6
...
...
@@ -23,12 +23,17 @@
*/
package
hudson.maven
;
import
hudson.maven.MavenBuildProxy.BuildCallable
;
import
hudson.maven.MavenBuildProxy.Filter.AsyncInvoker
;
import
hudson.model.BuildListener
;
import
jenkins.model.Jenkins
;
import
hudson.model.Result
;
import
hudson.remoting.Channel
;
import
hudson.remoting.DelegatingCallable
;
import
hudson.remoting.Future
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.text.NumberFormat
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -39,6 +44,7 @@ import java.util.Map;
*/
public
abstract
class
AbstractMavenBuilder
implements
DelegatingCallable
<
Result
,
IOException
>
{
private
static
final
long
serialVersionUID
=
-
2687215937784908860L
;
/**
* Goals to be executed in this Maven execution.
*/
...
...
@@ -53,6 +59,12 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
*/
protected
final
BuildListener
listener
;
/**
* Record all asynchronous executions as they are scheduled,
* to make sure they are all completed before we finish.
*/
protected
transient
/*final*/
List
<
Future
<?>>
futures
;
protected
AbstractMavenBuilder
(
BuildListener
listener
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
this
.
listener
=
listener
;
this
.
goals
=
goals
;
...
...
@@ -99,4 +111,29 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
return
Jenkins
.
getInstance
().
getPluginManager
().
uberClassLoader
;
}
protected
class
FilterImpl
extends
MavenBuildProxy2
.
Filter
<
MavenBuildProxy2
>
implements
Serializable
{
private
MavenBuildInformation
mavenBuildInformation
;
private
Channel
channel
;
public
FilterImpl
(
MavenBuildProxy2
core
,
MavenBuildInformation
mavenBuildInformation
,
Channel
channel
)
{
super
(
core
);
this
.
mavenBuildInformation
=
mavenBuildInformation
;
this
.
channel
=
channel
;
}
@Override
public
void
executeAsync
(
final
BuildCallable
<?,?>
program
)
throws
IOException
{
futures
.
add
(
channel
.
callAsync
(
new
AsyncInvoker
(
core
,
program
)));
}
private
static
final
long
serialVersionUID
=
1L
;
public
MavenBuildInformation
getMavenBuildInformation
()
{
return
mavenBuildInformation
;
}
}
}
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
0 → 100644
浏览文件 @
e14914e6
package
hudson.maven
;
import
hudson.Launcher
;
import
hudson.maven.MavenBuild.ProxyImpl2
;
import
hudson.model.BuildListener
;
import
hudson.model.Result
;
import
hudson.remoting.Channel
;
import
hudson.util.MaskingClassLoader
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Map.Entry
;
import
org.apache.maven.BuildFailureException
;
import
org.apache.maven.execution.MavenSession
;
import
org.apache.maven.execution.ReactorManager
;
import
org.apache.maven.lifecycle.LifecycleExecutionException
;
import
org.apache.maven.monitor.event.EventDispatcher
;
import
org.apache.maven.project.MavenProject
;
/**
* Runs Maven and builds the project.
*
* This is only used for
* {@link MavenModuleSet#isAggregatorStyleBuild() the aggregator style build}.
*/
final
class
Maven2Builder
extends
MavenBuilder
{
private
final
Map
<
ModuleName
,
MavenBuildProxy2
>
proxies
;
private
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
HashMap
<
ModuleName
,
List
<
MavenReporter
>>();
private
final
Map
<
ModuleName
,
List
<
ExecutedMojo
>>
executedMojos
=
new
HashMap
<
ModuleName
,
List
<
ExecutedMojo
>>();
private
long
mojoStartTime
;
private
MavenBuildProxy2
lastProxy
;
/**
* Kept so that we can finalize them in the end method.
*/
private
final
transient
Map
<
ModuleName
,
ProxyImpl2
>
sourceProxies
;
public
Maven2Builder
(
BuildListener
listener
,
Map
<
ModuleName
,
ProxyImpl2
>
proxies
,
Collection
<
MavenModule
>
modules
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
listener
,
goals
,
systemProps
);
this
.
sourceProxies
=
proxies
;
this
.
proxies
=
new
HashMap
<
ModuleName
,
MavenBuildProxy2
>(
proxies
);
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
e
.
setValue
(
new
FilterImpl
(
e
.
getValue
(),
mavenBuildInformation
,
Channel
.
current
()));
for
(
MavenModule
m
:
modules
)
reporters
.
put
(
m
.
getModuleName
(),
m
.
createReporters
());
}
/**
* Invoked after the maven has finished running, and in the master, not in the maven process.
*/
void
end
(
Launcher
launcher
)
throws
IOException
,
InterruptedException
{
for
(
Map
.
Entry
<
ModuleName
,
ProxyImpl2
>
e
:
sourceProxies
.
entrySet
())
{
ProxyImpl2
p
=
e
.
getValue
();
for
(
MavenReporter
r
:
reporters
.
get
(
e
.
getKey
()))
{
// we'd love to do this when the module build ends, but doing so requires
// we know how many task segments are in the current build.
r
.
end
(
p
.
owner
(),
launcher
,
listener
);
p
.
appendLastLog
();
}
p
.
close
();
}
}
@Override
public
Result
call
()
throws
IOException
{
try
{
if
(
MavenModuleSetBuild
.
debug
)
{
listener
.
getLogger
().
println
(
"Builder extends MavenBuilder in call "
+
Thread
.
currentThread
().
getContextClassLoader
());
}
return
super
.
call
();
}
finally
{
if
(
lastProxy
!=
null
)
lastProxy
.
appendLastLog
();
}
}
@Override
void
preBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
// set all modules which are not actually being build (in incremental builds) to NOT_BUILD
List
<
MavenProject
>
projects
=
rm
.
getSortedProjects
();
Set
<
ModuleName
>
buildingProjects
=
new
HashSet
<
ModuleName
>();
for
(
MavenProject
p
:
projects
)
{
buildingProjects
.
add
(
new
ModuleName
(
p
));
}
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
{
if
(!
buildingProjects
.
contains
(
e
.
getKey
()))
{
MavenBuildProxy2
proxy
=
e
.
getValue
();
proxy
.
start
();
proxy
.
setResult
(
Result
.
NOT_BUILT
);
proxy
.
end
();
}
}
}
void
postBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
// TODO
}
void
preModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
listener
.
getLogger
().
flush
();
// make sure the data until here are all written
proxy
.
start
();
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
preBuild
(
proxy
,
project
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
}
void
postModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
List
<
MavenReporter
>
rs
=
reporters
.
get
(
name
);
if
(
rs
==
null
)
{
// probe for issue #906
throw
new
AssertionError
(
"reporters.get("
+
name
+
")==null. reporters="
+
reporters
+
" proxies="
+
proxies
);
}
for
(
MavenReporter
r
:
rs
)
if
(!
r
.
postBuild
(
proxy
,
project
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
proxy
.
setExecutedMojos
(
executedMojos
.
get
(
name
));
listener
.
getLogger
().
flush
();
// make sure the data until here are all written
proxy
.
end
();
lastProxy
=
proxy
;
}
void
preExecute
(
MavenProject
project
,
MojoInfo
mojoInfo
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
preExecute
(
proxy
,
project
,
mojoInfo
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
mojoStartTime
=
System
.
currentTimeMillis
();
}
void
postExecute
(
MavenProject
project
,
MojoInfo
mojoInfo
,
Exception
exception
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
List
<
ExecutedMojo
>
mojoList
=
executedMojos
.
get
(
name
);
if
(
mojoList
==
null
)
executedMojos
.
put
(
name
,
mojoList
=
new
ArrayList
<
ExecutedMojo
>());
mojoList
.
add
(
new
ExecutedMojo
(
mojoInfo
,
System
.
currentTimeMillis
()-
mojoStartTime
));
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
postExecute
(
proxy
,
project
,
mojoInfo
,
listener
,
exception
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
if
(
exception
!=
null
)
proxy
.
setResult
(
Result
.
FAILURE
);
}
void
onReportGenerated
(
MavenProject
project
,
MavenReportInfo
report
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
reportGenerated
(
proxy
,
project
,
report
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
}
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
ClassLoader
getClassLoader
()
{
return
new
MaskingClassLoader
(
super
.
getClassLoader
()
);
}
}
\ No newline at end of file
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
浏览文件 @
e14914e6
...
...
@@ -28,7 +28,6 @@ import hudson.maven.MavenBuild.ProxyImpl2;
import
hudson.maven.util.ExecutionEventLogger
;
import
hudson.model.BuildListener
;
import
hudson.model.Executor
;
import
jenkins.model.Jenkins
;
import
hudson.model.Result
;
import
hudson.remoting.Channel
;
import
hudson.remoting.DelegatingCallable
;
...
...
@@ -79,12 +78,6 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
*/
private
final
boolean
profile
=
MavenProcessFactory
.
profile
;
/**
* Record all asynchronous executions as they are scheduled,
* to make sure they are all completed before we finish.
*/
protected
transient
/*final*/
List
<
Future
<?>>
futures
;
HudsonMavenExecutionResult
mavenExecutionResult
;
private
final
Map
<
ModuleName
,
MavenBuildProxy2
>
proxies
;
...
...
@@ -190,12 +183,6 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
}
// since reporters might be from plugins, use the uberjar to resolve them.
public
ClassLoader
getClassLoader
()
{
return
Jenkins
.
getInstance
().
getPluginManager
().
uberClassLoader
;
}
/**
* Invoked after the maven has finished running, and in the master, not in the maven process.
*/
...
...
@@ -212,34 +199,10 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
}
private
class
FilterImpl
extends
MavenBuildProxy2
.
Filter
<
MavenBuildProxy2
>
implements
Serializable
{
private
MavenBuildInformation
mavenBuildInformation
;
private
Channel
channel
;
public
FilterImpl
(
MavenBuildProxy2
core
,
MavenBuildInformation
mavenBuildInformation
,
Channel
channel
)
{
super
(
core
);
this
.
mavenBuildInformation
=
mavenBuildInformation
;
this
.
channel
=
channel
;
}
@Override
public
void
executeAsync
(
final
BuildCallable
<?,?>
program
)
throws
IOException
{
futures
.
add
(
channel
.
callAsync
(
new
AsyncInvoker
(
core
,
program
)));
}
private
static
final
long
serialVersionUID
=
1L
;
public
MavenBuildInformation
getMavenBuildInformation
()
{
return
mavenBuildInformation
;
}
}
private
static
final
class
MavenExecutionListener
extends
AbstractExecutionListener
implements
Serializable
,
ExecutionListener
{
private
static
final
long
serialVersionUID
=
4942789836756366116L
;
private
final
Maven3Builder
maven3Builder
;
/**
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
e14914e6
...
...
@@ -29,7 +29,6 @@ import hudson.AbortException;
import
hudson.EnvVars
;
import
hudson.FilePath
;
import
hudson.FilePath.FileCallable
;
import
hudson.Launcher
;
import
hudson.Util
;
import
hudson.maven.MavenBuild.ProxyImpl2
;
import
hudson.maven.reporters.MavenAggregatedArtifactRecord
;
...
...
@@ -54,7 +53,6 @@ import hudson.model.Result;
import
hudson.model.Run
;
import
hudson.model.StringParameterDefinition
;
import
hudson.model.TaskListener
;
import
hudson.remoting.Channel
;
import
hudson.remoting.VirtualChannel
;
import
hudson.scm.ChangeLogSet
;
import
hudson.tasks.BuildStep
;
...
...
@@ -63,14 +61,12 @@ import hudson.tasks.MailSender;
import
hudson.tasks.Maven.MavenInstallation
;
import
hudson.util.ArgumentListBuilder
;
import
hudson.util.IOUtils
;
import
hudson.util.MaskingClassLoader
;
import
hudson.util.StreamTaskListener
;
import
java.io.File
;
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
;
...
...
@@ -90,13 +86,8 @@ import jenkins.model.Jenkins;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.maven.BuildFailureException
;
import
org.apache.maven.artifact.versioning.ComparableVersion
;
import
org.apache.maven.execution.MavenSession
;
import
org.apache.maven.execution.ReactorManager
;
import
org.apache.maven.lifecycle.LifecycleExecutionException
;
import
org.apache.maven.model.building.ModelBuildingRequest
;
import
org.apache.maven.monitor.event.EventDispatcher
;
import
org.apache.maven.project.MavenProject
;
import
org.apache.maven.project.ProjectBuildingException
;
import
org.codehaus.plexus.util.PathTool
;
...
...
@@ -775,8 +766,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
else
{
Builder
builder
=
new
Builder
(
slistener
,
proxies
,
project
.
sortedActiveModules
,
margs
.
toList
(),
envVars
,
mavenBuildInformation
);
Maven2
Builder
builder
=
new
Maven2
Builder
(
slistener
,
proxies
,
project
.
sortedActiveModules
,
margs
.
toList
(),
envVars
,
mavenBuildInformation
);
MavenProbeAction
mpa
=
null
;
try
{
mpa
=
new
MavenProbeAction
(
project
,
process
.
channel
);
...
...
@@ -1015,184 +1006,6 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
/**
* Runs Maven and builds the project.
*
* This is only used for
* {@link MavenModuleSet#isAggregatorStyleBuild() the aggregator style build}.
*/
private
static
final
class
Builder
extends
MavenBuilder
{
private
final
Map
<
ModuleName
,
MavenBuildProxy2
>
proxies
;
private
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
HashMap
<
ModuleName
,
List
<
MavenReporter
>>();
private
final
Map
<
ModuleName
,
List
<
ExecutedMojo
>>
executedMojos
=
new
HashMap
<
ModuleName
,
List
<
ExecutedMojo
>>();
private
long
mojoStartTime
;
private
MavenBuildProxy2
lastProxy
;
/**
* Kept so that we can finalize them in the end method.
*/
private
final
transient
Map
<
ModuleName
,
ProxyImpl2
>
sourceProxies
;
public
Builder
(
BuildListener
listener
,
Map
<
ModuleName
,
ProxyImpl2
>
proxies
,
Collection
<
MavenModule
>
modules
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
listener
,
goals
,
systemProps
);
this
.
sourceProxies
=
proxies
;
this
.
proxies
=
new
HashMap
<
ModuleName
,
MavenBuildProxy2
>(
proxies
);
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
e
.
setValue
(
new
FilterImpl
(
e
.
getValue
(),
mavenBuildInformation
));
for
(
MavenModule
m
:
modules
)
reporters
.
put
(
m
.
getModuleName
(),
m
.
createReporters
());
}
private
class
FilterImpl
extends
MavenBuildProxy2
.
Filter
<
MavenBuildProxy2
>
implements
Serializable
{
private
MavenBuildInformation
mavenBuildInformation
;
public
FilterImpl
(
MavenBuildProxy2
core
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
core
);
this
.
mavenBuildInformation
=
mavenBuildInformation
;
}
@Override
public
void
executeAsync
(
final
BuildCallable
<?,?>
program
)
throws
IOException
{
futures
.
add
(
Channel
.
current
().
callAsync
(
new
AsyncInvoker
(
core
,
program
)));
}
public
MavenBuildInformation
getMavenBuildInformation
()
{
return
mavenBuildInformation
;
}
private
static
final
long
serialVersionUID
=
1L
;
}
/**
* Invoked after the maven has finished running, and in the master, not in the maven process.
*/
void
end
(
Launcher
launcher
)
throws
IOException
,
InterruptedException
{
for
(
Map
.
Entry
<
ModuleName
,
ProxyImpl2
>
e
:
sourceProxies
.
entrySet
())
{
ProxyImpl2
p
=
e
.
getValue
();
for
(
MavenReporter
r
:
reporters
.
get
(
e
.
getKey
()))
{
// we'd love to do this when the module build ends, but doing so requires
// we know how many task segments are in the current build.
r
.
end
(
p
.
owner
(),
launcher
,
listener
);
p
.
appendLastLog
();
}
p
.
close
();
}
}
@Override
public
Result
call
()
throws
IOException
{
try
{
if
(
debug
)
{
listener
.
getLogger
().
println
(
"Builder extends MavenBuilder in call "
+
Thread
.
currentThread
().
getContextClassLoader
());
}
return
super
.
call
();
}
finally
{
if
(
lastProxy
!=
null
)
lastProxy
.
appendLastLog
();
}
}
@Override
void
preBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
// set all modules which are not actually being build (in incremental builds) to NOT_BUILD
List
<
MavenProject
>
projects
=
rm
.
getSortedProjects
();
Set
<
ModuleName
>
buildingProjects
=
new
HashSet
<
ModuleName
>();
for
(
MavenProject
p
:
projects
)
{
buildingProjects
.
add
(
new
ModuleName
(
p
));
}
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
{
if
(!
buildingProjects
.
contains
(
e
.
getKey
()))
{
MavenBuildProxy2
proxy
=
e
.
getValue
();
proxy
.
start
();
proxy
.
setResult
(
Result
.
NOT_BUILT
);
proxy
.
end
();
}
}
}
void
postBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
// TODO
}
void
preModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
listener
.
getLogger
().
flush
();
// make sure the data until here are all written
proxy
.
start
();
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
preBuild
(
proxy
,
project
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
}
void
postModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
List
<
MavenReporter
>
rs
=
reporters
.
get
(
name
);
if
(
rs
==
null
)
{
// probe for issue #906
throw
new
AssertionError
(
"reporters.get("
+
name
+
")==null. reporters="
+
reporters
+
" proxies="
+
proxies
);
}
for
(
MavenReporter
r
:
rs
)
if
(!
r
.
postBuild
(
proxy
,
project
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
proxy
.
setExecutedMojos
(
executedMojos
.
get
(
name
));
listener
.
getLogger
().
flush
();
// make sure the data until here are all written
proxy
.
end
();
lastProxy
=
proxy
;
}
void
preExecute
(
MavenProject
project
,
MojoInfo
mojoInfo
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
preExecute
(
proxy
,
project
,
mojoInfo
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
mojoStartTime
=
System
.
currentTimeMillis
();
}
void
postExecute
(
MavenProject
project
,
MojoInfo
mojoInfo
,
Exception
exception
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
List
<
ExecutedMojo
>
mojoList
=
executedMojos
.
get
(
name
);
if
(
mojoList
==
null
)
executedMojos
.
put
(
name
,
mojoList
=
new
ArrayList
<
ExecutedMojo
>());
mojoList
.
add
(
new
ExecutedMojo
(
mojoInfo
,
System
.
currentTimeMillis
()-
mojoStartTime
));
MavenBuildProxy2
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
postExecute
(
proxy
,
project
,
mojoInfo
,
listener
,
exception
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
if
(
exception
!=
null
)
proxy
.
setResult
(
Result
.
FAILURE
);
}
void
onReportGenerated
(
MavenProject
project
,
MavenReportInfo
report
)
throws
IOException
,
InterruptedException
,
hudson
.
maven
.
agent
.
AbortException
{
ModuleName
name
=
new
ModuleName
(
project
);
MavenBuildProxy
proxy
=
proxies
.
get
(
name
);
for
(
MavenReporter
r
:
reporters
.
get
(
name
))
if
(!
r
.
reportGenerated
(
proxy
,
project
,
report
,
listener
))
throw
new
hudson
.
maven
.
agent
.
AbortException
(
r
+
" failed"
);
}
private
static
final
long
serialVersionUID
=
1L
;
@Override
public
ClassLoader
getClassLoader
()
{
return
new
MaskingClassLoader
(
super
.
getClassLoader
()
);
}
}
/**
* Used to tunnel exception from Maven through remoting.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录