Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
e295fdf1
J
jenkins
项目概览
FIY695
/
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,发现更多精彩内容 >>
提交
e295fdf1
编写于
12月 30, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'filterimpl-serialization' of github.com:kutzi/jenkins
上级
ce2c0c5a
2d958cde
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
112 addition
and
133 deletion
+112
-133
maven-plugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
...ugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
+49
-4
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
+7
-31
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
+21
-47
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
+12
-12
maven-plugin/src/main/java/hudson/maven/MavenBuilder.java
maven-plugin/src/main/java/hudson/maven/MavenBuilder.java
+3
-2
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+20
-37
未找到文件。
maven-plugin/src/main/java/hudson/maven/AbstractMavenBuilder.java
浏览文件 @
e295fdf1
...
...
@@ -23,6 +23,8 @@
*/
package
hudson.maven
;
import
hudson.Launcher
;
import
hudson.maven.MavenBuild.ProxyImpl2
;
import
hudson.model.BuildListener
;
import
hudson.model.Executor
;
import
hudson.model.Result
;
...
...
@@ -33,6 +35,8 @@ import hudson.remoting.Future;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.text.NumberFormat
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CopyOnWriteArrayList
;
...
...
@@ -42,6 +46,7 @@ import jenkins.model.Jenkins;
/**
* @author Olivier Lamy
* @author Christoph Kutzinski
*
*/
public
abstract
class
AbstractMavenBuilder
implements
DelegatingCallable
<
Result
,
IOException
>
{
...
...
@@ -61,16 +66,45 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
*/
protected
final
BuildListener
listener
;
protected
Map
<
ModuleName
,
FilterImpl
>
proxies
;
/**
* Kept so that we can finalize them in the end method.
*/
protected
final
transient
Map
<
ModuleName
,
ProxyImpl2
>
sourceProxies
=
new
HashMap
<
ModuleName
,
MavenBuild
.
ProxyImpl2
>();
protected
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
HashMap
<
ModuleName
,
List
<
MavenReporter
>>();
/**
* Record all asynchronous executions as they are scheduled,
* to make sure they are all completed before we finish.
*/
pr
ivate
transient
/*final*/
List
<
Future
<?>>
futures
;
pr
otected
transient
/*final*/
List
<
Future
<?>>
futures
;
protected
AbstractMavenBuilder
(
BuildListener
listener
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
protected
AbstractMavenBuilder
(
BuildListener
listener
,
Collection
<
MavenModule
>
modules
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
this
.
listener
=
listener
;
this
.
goals
=
goals
;
this
.
systemProps
=
systemProps
;
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
();
}
}
protected
String
formatArgs
(
List
<
String
>
args
)
{
...
...
@@ -119,6 +153,11 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
*/
protected
void
initializeAsynchronousExecutions
()
{
futures
=
new
CopyOnWriteArrayList
<
Future
<?>>();
if
(
this
.
proxies
!=
null
)
{
for
(
FilterImpl
proxy
:
this
.
proxies
.
values
())
{
proxy
.
setFutures
(
futures
);
}
}
}
/**
...
...
@@ -160,7 +199,7 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
}
}
protected
class
FilterImpl
extends
MavenBuildProxy2
.
Filter
<
MavenBuildProxy2
>
implements
Serializable
{
protected
static
class
FilterImpl
extends
MavenBuildProxy2
.
Filter
<
MavenBuildProxy2
>
implements
Serializable
{
private
MavenBuildInformation
mavenBuildInformation
;
...
...
@@ -173,6 +212,8 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
*/
private
transient
Channel
channel
;
private
transient
List
<
Future
<?>>
futures
;
public
FilterImpl
(
MavenBuildProxy2
core
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
core
);
this
.
mavenBuildInformation
=
mavenBuildInformation
;
...
...
@@ -189,7 +230,7 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
@Override
public
void
executeAsync
(
final
BuildCallable
<?,?>
program
)
throws
IOException
{
recordAsynchronousExecution
(
futures
.
add
(
channel
.
callAsync
(
new
AsyncInvoker
(
core
,
program
)));
}
...
...
@@ -197,6 +238,10 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
public
MavenBuildInformation
getMavenBuildInformation
()
{
return
mavenBuildInformation
;
}
public
void
setFutures
(
List
<
Future
<?>>
futures
)
{
this
.
futures
=
futures
;
}
public
Object
readResolve
()
{
channel
=
Channel
.
current
();
...
...
maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
浏览文件 @
e295fdf1
...
...
@@ -24,7 +24,6 @@
*/
package
hudson.maven
;
import
hudson.Launcher
;
import
hudson.maven.MavenBuild.ProxyImpl2
;
import
hudson.model.BuildListener
;
import
hudson.model.Result
;
...
...
@@ -53,42 +52,19 @@ import org.apache.maven.project.MavenProject;
*/
@SuppressWarnings
(
"deprecation"
)
// as we're restricted to Maven 2.x API here, but compile against Maven 3.x, we cannot avoid deprecations
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
));
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
();
super
(
listener
,
modules
,
goals
,
systemProps
);
this
.
sourceProxies
.
putAll
(
proxies
);
this
.
proxies
=
new
HashMap
<
ModuleName
,
FilterImpl
>();
for
(
Entry
<
ModuleName
,
ProxyImpl2
>
e
:
this
.
sourceProxies
.
entrySet
())
{
this
.
proxies
.
put
(
e
.
getKey
(),
new
FilterImpl
(
e
.
getValue
(),
mavenBuildInformation
));
}
}
...
...
@@ -116,7 +92,7 @@ final class Maven2Builder extends MavenBuilder {
buildingProjects
.
add
(
new
ModuleName
(
p
));
}
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
{
for
(
Entry
<
ModuleName
,
FilterImpl
>
e
:
this
.
proxies
.
entrySet
())
{
if
(!
buildingProjects
.
contains
(
e
.
getKey
()))
{
MavenBuildProxy2
proxy
=
e
.
getValue
();
proxy
.
start
();
...
...
maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
浏览文件 @
e295fdf1
...
...
@@ -37,13 +37,13 @@ import java.io.PrintStream;
import
java.io.Serializable
;
import
java.lang.reflect.InvocationTargetException
;
import
java.text.NumberFormat
;
import
java.util.
Date
;
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
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.logging.Logger
;
...
...
@@ -77,29 +77,21 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
HudsonMavenExecutionResult
mavenExecutionResult
;
private
final
Map
<
ModuleName
,
MavenBuildProxy2
>
proxies
;
private
final
Map
<
ModuleName
,
ProxyImpl2
>
sourceProxies
;
private
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
HashMap
<
ModuleName
,
List
<
MavenReporter
>>();
private
final
MavenBuildInformation
mavenBuildInformation
;
protected
Maven3Builder
(
BuildListener
listener
,
Map
<
ModuleName
,
ProxyImpl2
>
proxies
,
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
listener
,
goals
,
systemProps
);
this
.
mavenBuildInformation
=
mavenBuildInformation
;
sourceProxies
=
new
HashMap
<
ModuleName
,
ProxyImpl2
>(
proxies
);
this
.
proxies
=
new
HashMap
<
ModuleName
,
MavenBuildProxy2
>(
proxies
);
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
e
.
setValue
(
new
FilterImpl
(
e
.
getValue
(),
this
.
mavenBuildInformation
));
this
.
reporters
.
putAll
(
reporters
);
protected
Maven3Builder
(
BuildListener
listener
,
Map
<
ModuleName
,
ProxyImpl2
>
proxies
,
Collection
<
MavenModule
>
modules
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
,
MavenBuildInformation
mavenBuildInformation
)
{
super
(
listener
,
modules
,
goals
,
systemProps
);
this
.
sourceProxies
.
putAll
(
proxies
);
this
.
proxies
=
new
HashMap
<
ModuleName
,
FilterImpl
>();
for
(
Entry
<
ModuleName
,
ProxyImpl2
>
e
:
this
.
sourceProxies
.
entrySet
())
{
this
.
proxies
.
put
(
e
.
getKey
(),
new
FilterImpl
(
e
.
getValue
(),
mavenBuildInformation
));
}
}
public
Result
call
()
throws
IOException
{
MavenExecutionListener
mavenExecutionListener
=
new
MavenExecutionListener
(
this
);
try
{
initializeAsynchronousExecutions
();
MavenExecutionListener
mavenExecutionListener
=
new
MavenExecutionListener
(
this
);
Maven3Launcher
.
setMavenExecutionListener
(
mavenExecutionListener
);
markAsSuccess
=
false
;
...
...
@@ -167,22 +159,6 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
}
/**
* 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
();
}
}
private
static
final
class
MavenExecutionListener
extends
AbstractExecutionListener
implements
Serializable
,
ExecutionListener
{
private
static
final
long
serialVersionUID
=
4942789836756366116L
;
...
...
@@ -195,11 +171,11 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
long
overheadTime
;
private
final
Map
<
ModuleName
,
MavenBuildProxy2
>
proxies
;
private
final
Map
<
ModuleName
,
FilterImpl
>
proxies
;
private
final
Map
<
ModuleName
,
List
<
ExecutedMojo
>>
executedMojosPerModule
=
new
ConcurrentHashMap
<
ModuleName
,
List
<
ExecutedMojo
>>();
private
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
ConcurrentHashMap
<
ModuleName
,
List
<
MavenReporter
>>()
;
private
final
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
;
private
final
Map
<
ModuleName
,
Long
>
currentMojoStartPerModuleName
=
new
ConcurrentHashMap
<
ModuleName
,
Long
>();
...
...
@@ -207,18 +183,16 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
public
MavenExecutionListener
(
Maven3Builder
maven3Builder
)
{
this
.
maven3Builder
=
maven3Builder
;
this
.
proxies
=
new
ConcurrentHashMap
<
ModuleName
,
MavenBuildProxy2
>(
maven3Builder
.
proxies
);
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
{
e
.
setValue
(
maven3Builder
.
new
FilterImpl
(
e
.
getValue
(),
maven3Builder
.
mavenBuildInformation
,
Channel
.
current
()));
executedMojosPerModule
.
put
(
e
.
getKey
(),
new
CopyOnWriteArrayList
<
ExecutedMojo
>()
);
this
.
proxies
=
new
ConcurrentHashMap
<
ModuleName
,
FilterImpl
>(
maven3Builder
.
proxies
);
for
(
ModuleName
name
:
this
.
proxies
.
keySet
())
{
executedMojosPerModule
.
put
(
name
,
new
CopyOnWriteArrayList
<
ExecutedMojo
>()
);
}
this
.
reporters
.
putAll
(
new
ConcurrentHashMap
<
ModuleName
,
List
<
MavenReporter
>>(
maven3Builder
.
reporters
)
);
this
.
reporters
=
new
ConcurrentHashMap
<
ModuleName
,
List
<
MavenReporter
>>(
maven3Builder
.
reporters
);
this
.
eventLogger
=
new
ExecutionEventLogger
(
new
PrintStreamLogger
(
maven3Builder
.
listener
.
getLogger
()
)
);
}
private
MavenBuildProxy2
getMavenBuildProxy2
(
MavenProject
mavenProject
)
{
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
entry
:
proxies
.
entrySet
())
{
for
(
Entry
<
ModuleName
,
FilterImpl
>
entry
:
proxies
.
entrySet
())
{
if
(
entry
.
getKey
().
compareTo
(
new
ModuleName
(
mavenProject
)
)
==
0
)
{
return
entry
.
getValue
();
}
...
...
@@ -235,7 +209,7 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
}
private
void
initMojoStartTime
(
MavenProject
mavenProject
)
{
this
.
currentMojoStartPerModuleName
.
put
(
new
ModuleName
(
mavenProject
),
new
Date
().
getTime
(
)
);
this
.
currentMojoStartPerModuleName
.
put
(
new
ModuleName
(
mavenProject
),
Long
.
valueOf
(
System
.
currentTimeMillis
()
)
);
}
private
Long
getMojoStartTime
(
MavenProject
mavenProject
)
{
...
...
@@ -264,7 +238,7 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
buildingProjects
.
add
(
new
ModuleName
(
p
));
}
for
(
Entry
<
ModuleName
,
MavenBuildProxy2
>
e
:
this
.
proxies
.
entrySet
())
{
for
(
Entry
<
ModuleName
,
FilterImpl
>
e
:
this
.
proxies
.
entrySet
())
{
if
(!
buildingProjects
.
contains
(
e
.
getKey
()))
{
//maven3Builder.listener.getLogger().println("Project " + e.getKey() + " needs not be build");
MavenBuildProxy2
proxy
=
e
.
getValue
();
...
...
@@ -521,7 +495,7 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal
executedMojosPerModule
.
put
(
new
ModuleName
(
p
),
m
=
new
CopyOnWriteArrayList
<
ExecutedMojo
>());
Long
startTime
=
getMojoStartTime
(
event
.
getProject
()
);
m
.
add
(
new
ExecutedMojo
(
mojoInfo
,
startTime
==
null
?
0
:
new
Date
().
getTime
()
-
startTime
));
m
.
add
(
new
ExecutedMojo
(
mojoInfo
,
startTime
==
null
?
0
:
System
.
currentTimeMillis
()
-
startTime
));
}
/**
...
...
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
浏览文件 @
e295fdf1
...
...
@@ -296,19 +296,19 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
*/
private
static
final
class
Builder
extends
MavenBuilder
{
private
final
MavenBuildProxy
buildProxy
;
private
final
MavenReporter
[]
reporters
;
/**
* Records of what was executed.
*/
private
final
List
<
ExecutedMojo
>
executedMojos
=
new
ArrayList
<
ExecutedMojo
>();
private
final
ModuleName
moduleName
;
private
long
startTime
;
public
Builder
(
BuildListener
listener
,
MavenBuildProxy
buildProxy
,
Maven
Reporter
[]
reporters
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
super
(
listener
,
goals
,
systemProps
);
public
Builder
(
BuildListener
listener
,
MavenBuildProxy
buildProxy
,
Maven
Module
module
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
super
(
listener
,
Collections
.
singleton
(
module
),
goals
,
systemProps
);
this
.
buildProxy
=
new
FilterImpl
(
buildProxy
);
this
.
reporters
=
reporters
;
this
.
moduleName
=
module
.
getModuleName
()
;
}
private
class
FilterImpl
extends
MavenBuildProxy
.
Filter
<
MavenBuildProxy
>
implements
Serializable
{
...
...
@@ -326,20 +326,20 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
@Override
void
preBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
r
.
preBuild
(
buildProxy
,
rm
.
getTopLevelProject
(),
listener
);
}
@Override
void
postBuild
(
MavenSession
session
,
ReactorManager
rm
,
EventDispatcher
dispatcher
)
throws
BuildFailureException
,
LifecycleExecutionException
,
IOException
,
InterruptedException
{
buildProxy
.
setExecutedMojos
(
executedMojos
);
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
r
.
postBuild
(
buildProxy
,
rm
.
getTopLevelProject
(),
listener
);
}
@Override
void
preExecute
(
MavenProject
project
,
MojoInfo
info
)
throws
IOException
,
InterruptedException
,
AbortException
{
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
if
(!
r
.
preExecute
(
buildProxy
,
project
,
info
,
listener
))
throw
new
AbortException
(
r
+
" failed"
);
...
...
@@ -350,28 +350,28 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
void
postExecute
(
MavenProject
project
,
MojoInfo
info
,
Exception
exception
)
throws
IOException
,
InterruptedException
,
AbortException
{
executedMojos
.
add
(
new
ExecutedMojo
(
info
,
System
.
currentTimeMillis
()-
startTime
));
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
if
(!
r
.
postExecute
(
buildProxy
,
project
,
info
,
listener
,
exception
))
throw
new
AbortException
(
r
+
" failed"
);
}
@Override
void
onReportGenerated
(
MavenProject
project
,
MavenReportInfo
report
)
throws
IOException
,
InterruptedException
,
AbortException
{
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
if
(!
r
.
reportGenerated
(
buildProxy
,
project
,
report
,
listener
))
throw
new
AbortException
(
r
+
" failed"
);
}
@Override
void
preModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
AbortException
{
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
if
(!
r
.
enterModule
(
buildProxy
,
project
,
listener
))
throw
new
AbortException
(
r
+
" failed"
);
}
@Override
void
postModule
(
MavenProject
project
)
throws
InterruptedException
,
IOException
,
AbortException
{
for
(
MavenReporter
r
:
reporters
)
for
(
MavenReporter
r
:
reporters
.
get
(
moduleName
)
)
if
(!
r
.
leaveModule
(
buildProxy
,
project
,
listener
))
throw
new
AbortException
(
r
+
" failed"
);
}
...
...
@@ -725,7 +725,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
try
{
Result
r
=
process
.
call
(
new
Builder
(
listener
,
new
ProxyImpl
(),
reporters
.
toArray
(
new
MavenReporter
[
reporters
.
size
()]
),
margs
.
toList
(),
systemProps
));
getProject
(
),
margs
.
toList
(),
systemProps
));
normalExit
=
true
;
return
r
;
}
finally
{
...
...
maven-plugin/src/main/java/hudson/maven/MavenBuilder.java
浏览文件 @
e295fdf1
...
...
@@ -40,6 +40,7 @@ import java.io.PrintStream;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.text.NumberFormat
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.maven.BuildFailureException
;
...
...
@@ -79,8 +80,8 @@ public abstract class MavenBuilder extends AbstractMavenBuilder implements Deleg
*/
private
final
boolean
profile
=
MavenProcessFactory
.
profile
;
protected
MavenBuilder
(
BuildListener
listener
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
super
(
listener
,
goals
,
systemProps
);
protected
MavenBuilder
(
BuildListener
listener
,
Collection
<
MavenModule
>
modules
,
List
<
String
>
goals
,
Map
<
String
,
String
>
systemProps
)
{
super
(
listener
,
modules
,
goals
,
systemProps
);
}
/**
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
e295fdf1
...
...
@@ -388,7 +388,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
public
void
setMavenVersionUsed
(
String
mavenVersionUsed
)
throws
IOException
{
this
.
mavenVersionUsed
=
mavenVersionUsed
;
this
.
mavenVersionUsed
=
Util
.
intern
(
mavenVersionUsed
)
;
save
();
}
...
...
@@ -699,7 +699,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
pom
=
parentLoc
;
ProcessCache
.
MavenProcess
process
=
null
;
final
ProcessCache
.
MavenProcess
process
;
boolean
maven3orLater
=
mavenBuildInformation
.
isMaven3OrLater
();
if
(
maven3orLater
)
...
...
@@ -778,44 +778,27 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
if
(
maven3orLater
)
{
Map
<
ModuleName
,
List
<
MavenReporter
>>
reporters
=
new
HashMap
<
ModuleName
,
List
<
MavenReporter
>>(
project
.
sortedActiveModules
.
size
());
for
(
MavenModule
mavenModule
:
project
.
sortedActiveModules
)
{
reporters
.
put
(
mavenModule
.
getModuleName
(),
mavenModule
.
createReporters
()
);
}
Maven3Builder
maven3Builder
=
new
Maven3Builder
(
slistener
,
proxies
,
reporters
,
margs
.
toList
(),
envVars
,
mavenBuildInformation
);
MavenProbeAction
mpa
=
null
;
try
{
mpa
=
new
MavenProbeAction
(
project
,
process
.
channel
);
addAction
(
mpa
);
r
=
process
.
call
(
maven3Builder
);
return
r
;
}
finally
{
maven3Builder
.
end
(
launcher
);
getActions
().
remove
(
mpa
);
process
.
discard
();
}
final
AbstractMavenBuilder
builder
;
if
(
maven3orLater
)
{
builder
=
new
Maven3Builder
(
slistener
,
proxies
,
project
.
sortedActiveModules
,
margs
.
toList
(),
envVars
,
mavenBuildInformation
);
}
else
{
Maven2Builder
builder
=
builder
=
new
Maven2Builder
(
slistener
,
proxies
,
project
.
sortedActiveModules
,
margs
.
toList
(),
envVars
,
mavenBuildInformation
);
MavenProbeAction
mpa
=
null
;
try
{
mpa
=
new
MavenProbeAction
(
project
,
process
.
channel
);
addAction
(
mpa
);
r
=
process
.
call
(
builder
);
return
r
;
}
finally
{
builder
.
end
(
launcher
);
getActions
().
remove
(
mpa
);
process
.
discard
();
}
}
MavenProbeAction
mpa
=
null
;
try
{
mpa
=
new
MavenProbeAction
(
project
,
process
.
channel
);
addAction
(
mpa
);
r
=
process
.
call
(
builder
);
return
r
;
}
finally
{
builder
.
end
(
launcher
);
getActions
().
remove
(
mpa
);
process
.
discard
();
}
}
catch
(
InterruptedException
e
)
{
r
=
Executor
.
currentExecutor
().
abortResult
();
throw
e
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录