Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
28594298
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,发现更多精彩内容 >>
提交
28594298
编写于
12月 19, 2010
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix junit failures regarding incremental builds
上级
0a9d2826
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
55 addition
and
38 deletion
+55
-38
maven-agent/pom.xml
maven-agent/pom.xml
+2
-2
maven-interceptor/pom.xml
maven-interceptor/pom.xml
+1
-1
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+20
-9
maven3-agent/pom.xml
maven3-agent/pom.xml
+2
-1
test/pom.xml
test/pom.xml
+5
-0
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
+25
-25
未找到文件。
maven-agent/pom.xml
浏览文件 @
28594298
...
@@ -33,10 +33,10 @@ THE SOFTWARE.
...
@@ -33,10 +33,10 @@ THE SOFTWARE.
<artifactId>
maven-agent
</artifactId>
<artifactId>
maven-agent
</artifactId>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
Hudson Maven CLI agent
</name>
<name>
Hudson Maven
2
CLI agent
</name>
<description>
<description>
Code that boots up Maven2 with Hudson's remoting support in place.
Code that boots up Maven2 with Hudson's remoting support in place.
Used for the native m
2
support.
Used for the native m
aven
support.
</description>
</description>
<build>
<build>
...
...
maven-interceptor/pom.xml
浏览文件 @
28594298
...
@@ -33,7 +33,7 @@ THE SOFTWARE.
...
@@ -33,7 +33,7 @@ THE SOFTWARE.
<artifactId>
maven-interceptor
</artifactId>
<artifactId>
maven-interceptor
</artifactId>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
Hudson Maven PluginManager interceptor
</name>
<name>
Hudson Maven
2
PluginManager interceptor
</name>
<description>
<description>
Plexus module that intercepts invocations of key Maven components
Plexus module that intercepts invocations of key Maven components
so that Hudson can monitor what's going on in Maven.
so that Hudson can monitor what's going on in Maven.
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
28594298
...
@@ -59,6 +59,7 @@ import hudson.util.MaskingClassLoader;
...
@@ -59,6 +59,7 @@ import hudson.util.MaskingClassLoader;
import
hudson.util.StreamTaskListener
;
import
hudson.util.StreamTaskListener
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FilenameFilter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InterruptedIOException
;
import
java.io.InterruptedIOException
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
...
@@ -476,7 +477,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -476,7 +477,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
listener
.
getLogger
().
println
(
"Found mavenVersion "
+
mavenVersion
+
" from file "
+
mavenInformation
.
getVersionResourcePath
());
listener
.
getLogger
().
println
(
"Found mavenVersion "
+
mavenVersion
+
" from file "
+
mavenInformation
.
getVersionResourcePath
());
if
(!
project
.
isAggregatorStyleBuild
())
{
if
(!
project
.
isAggregatorStyleBuild
())
{
parsePoms
(
listener
,
logger
,
envVars
,
mvn
);
parsePoms
(
listener
,
logger
,
envVars
,
mvn
,
getModuleRoot
().
getRemote
()
);
// start module builds
// start module builds
logger
.
println
(
"Triggering "
+
project
.
getRootModule
().
getModuleName
());
logger
.
println
(
"Triggering "
+
project
.
getRootModule
().
getModuleName
());
project
.
getRootModule
().
scheduleBuild
(
new
UpstreamCause
((
Run
<?,?>)
MavenModuleSetBuild
.
this
));
project
.
getRootModule
().
scheduleBuild
(
new
UpstreamCause
((
Run
<?,?>)
MavenModuleSetBuild
.
this
));
...
@@ -501,7 +502,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -501,7 +502,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
if
(!
preBuild
(
listener
,
project
.
getPublishers
()))
if
(!
preBuild
(
listener
,
project
.
getPublishers
()))
return
Result
.
FAILURE
;
return
Result
.
FAILURE
;
parsePoms
(
listener
,
logger
,
envVars
,
mvn
);
// #5428 : do pre-build *before* parsing pom
parsePoms
(
listener
,
logger
,
envVars
,
mvn
,
getModuleRoot
().
getRemote
()
);
// #5428 : do pre-build *before* parsing pom
SplittableBuildListener
slistener
=
new
SplittableBuildListener
(
listener
);
SplittableBuildListener
slistener
=
new
SplittableBuildListener
(
listener
);
proxies
=
new
HashMap
<
ModuleName
,
ProxyImpl2
>();
proxies
=
new
HashMap
<
ModuleName
,
ProxyImpl2
>();
List
<
String
>
changedModules
=
new
ArrayList
<
String
>();
List
<
String
>
changedModules
=
new
ArrayList
<
String
>();
...
@@ -565,7 +566,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -565,7 +566,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
// If incrementalBuild is set, and we're on Maven 2.1 or later, *and* there's at least one module
// If incrementalBuild is set, and we're on Maven 2.1 or later, *and* there's at least one module
// listed in changedModules, do the Maven incremental build commands - if there are no changed modules,
// listed in changedModules, do the Maven incremental build commands - if there are no changed modules,
// We're building everything anyway.
// We're building everything anyway.
if
(
project
.
isIncrementalBuild
()
&&
mvn
.
isMaven2_1
(
launcher
)
&&
!
changedModules
.
isEmpty
())
{
boolean
maven2_1orLater
=
new
ComparableVersion
(
mavenVersion
).
compareTo
(
new
ComparableVersion
(
"2.1"
)
)
>=
0
;
if
(
project
.
isIncrementalBuild
()
&&
maven2_1orLater
&&
!
changedModules
.
isEmpty
())
{
margs
.
add
(
"-amd"
);
margs
.
add
(
"-amd"
);
margs
.
add
(
"-pl"
,
Util
.
join
(
changedModules
,
","
));
margs
.
add
(
"-pl"
,
Util
.
join
(
changedModules
,
","
));
}
}
...
@@ -659,12 +661,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -659,12 +661,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
}
}
private
void
parsePoms
(
BuildListener
listener
,
PrintStream
logger
,
EnvVars
envVars
,
MavenInstallation
mvn
)
throws
IOException
,
InterruptedException
{
private
void
parsePoms
(
BuildListener
listener
,
PrintStream
logger
,
EnvVars
envVars
,
MavenInstallation
mvn
,
String
workspacePath
)
throws
IOException
,
InterruptedException
{
logger
.
println
(
"Parsing POMs"
);
logger
.
println
(
"Parsing POMs"
);
List
<
PomInfo
>
poms
;
List
<
PomInfo
>
poms
;
try
{
try
{
poms
=
getModuleRoot
().
act
(
new
PomParser
(
listener
,
mvn
,
project
));
poms
=
getModuleRoot
().
act
(
new
PomParser
(
listener
,
mvn
,
project
,
workspacePath
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
if
(
e
.
getCause
()
instanceof
AbortException
)
if
(
e
.
getCause
()
instanceof
AbortException
)
throw
(
AbortException
)
e
.
getCause
();
throw
(
AbortException
)
e
.
getCause
();
...
@@ -964,8 +966,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -964,8 +966,8 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
private
final
boolean
nonRecursive
;
private
final
boolean
nonRecursive
;
// We're called against the module root, not the workspace, which can cause a lot of confusion.
// We're called against the module root, not the workspace, which can cause a lot of confusion.
private
final
String
workspaceProper
;
private
final
String
workspaceProper
;
private
String
workspacePath
;
public
PomParser
(
BuildListener
listener
,
MavenInstallation
mavenHome
,
MavenModuleSet
project
)
{
public
PomParser
(
BuildListener
listener
,
MavenInstallation
mavenHome
,
MavenModuleSet
project
,
String
workspacePath
)
{
// project cannot be shipped to the remote JVM, so all the relevant properties need to be captured now.
// project cannot be shipped to the remote JVM, so all the relevant properties need to be captured now.
this
.
listener
=
listener
;
this
.
listener
=
listener
;
this
.
mavenHome
=
mavenHome
;
this
.
mavenHome
=
mavenHome
;
...
@@ -980,6 +982,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -980,6 +982,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
this
.
privateRepository
=
null
;
this
.
privateRepository
=
null
;
}
}
this
.
alternateSettings
=
project
.
getAlternateSettings
();
this
.
alternateSettings
=
project
.
getAlternateSettings
();
this
.
workspacePath
=
FilenameUtils
.
normalize
(
workspacePath
);
}
}
...
@@ -1101,11 +1104,19 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
...
@@ -1101,11 +1104,19 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
}
}
private
void
toPomInfo
(
MavenProject
mp
,
PomInfo
parent
,
Map
<
String
,
MavenProject
>
abslPath
,
Set
<
PomInfo
>
infos
)
throws
IOException
{
private
void
toPomInfo
(
MavenProject
mp
,
PomInfo
parent
,
Map
<
String
,
MavenProject
>
abslPath
,
Set
<
PomInfo
>
infos
)
throws
IOException
{
PomInfo
pi
=
new
PomInfo
(
mp
,
parent
,
mp
.
getBasedir
().
getAbsolutePath
());
String
absolutePath
=
FilenameUtils
.
normalize
(
mp
.
getBasedir
().
getAbsolutePath
());
String
relPath
=
StringUtils
.
removeStart
(
absolutePath
,
this
.
workspacePath
);
// root must be marked with only /
if
(
StringUtils
.
isBlank
(
relPath
))
{
relPath
=
"/"
;
}
PomInfo
pi
=
new
PomInfo
(
mp
,
parent
,
relPath
);
infos
.
add
(
pi
);
infos
.
add
(
pi
);
for
(
String
modulePath
:
mp
.
getModules
())
for
(
String
modulePath
:
mp
.
getModules
())
{
{
if
(
StringUtils
.
isBlank
(
modulePath
))
continue
;
if
(
StringUtils
.
isBlank
(
modulePath
))
{
continue
;
}
File
path
=
new
File
(
mp
.
getBasedir
(),
modulePath
);
File
path
=
new
File
(
mp
.
getBasedir
(),
modulePath
);
MavenProject
child
=
abslPath
.
get
(
path
.
getCanonicalPath
());
MavenProject
child
=
abslPath
.
get
(
path
.
getCanonicalPath
());
toPomInfo
(
child
,
pi
,
abslPath
,
infos
);
toPomInfo
(
child
,
pi
,
abslPath
,
infos
);
...
...
maven3-agent/pom.xml
浏览文件 @
28594298
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
<version>
1.389-SNAPSHOT
</version>
<version>
1.389-SNAPSHOT
</version>
</parent>
</parent>
<artifactId>
maven3-agent
</artifactId>
<artifactId>
maven3-agent
</artifactId>
<name>
Hudson Maven3 Agent
</name>
<name>
Hudson Maven3 CLI Agent
</name>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.jvnet.hudson.main
</groupId>
<groupId>
org.jvnet.hudson.main
</groupId>
...
...
test/pom.xml
浏览文件 @
28594298
...
@@ -40,6 +40,7 @@ THE SOFTWARE.
...
@@ -40,6 +40,7 @@ THE SOFTWARE.
<properties>
<properties>
<concurrency>
1
</concurrency>
<!-- -1 means # of processors in the system -->
<concurrency>
1
</concurrency>
<!-- -1 means # of processors in the system -->
<mavenDebug>
false
</mavenDebug>
</properties>
</properties>
<build>
<build>
...
@@ -70,6 +71,10 @@ THE SOFTWARE.
...
@@ -70,6 +71,10 @@ THE SOFTWARE.
<name>
hudson.ClassicPluginStrategy.useAntClassLoader
</name>
<name>
hudson.ClassicPluginStrategy.useAntClassLoader
</name>
<value>
true
</value>
<value>
true
</value>
</property>
</property>
<property>
<name>
hudson.maven.debug
</name>
<value>
${mavenDebug}
</value>
</property>
</systemProperties>
</systemProperties>
</configuration>
</configuration>
</execution>
</execution>
...
...
test/src/test/java/hudson/maven/MavenMultiModuleTest.java
浏览文件 @
28594298
...
@@ -34,32 +34,32 @@ public class MavenMultiModuleTest extends HudsonTestCase {
...
@@ -34,32 +34,32 @@ public class MavenMultiModuleTest extends HudsonTestCase {
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
configureDefaultMaven
(
"apache-maven-2.2.1"
,
MavenInstallation
.
MAVEN_21
);
MavenModuleSet
m
=
createMavenProject
();
MavenModuleSet
m
=
createMavenProject
();
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
getReporters
().
add
(
new
TestReporter
());
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
),
m
.
setScm
(
new
ExtractResourceWithChangesSCM
(
getClass
().
getResource
(
"maven-multimod.zip"
),
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
getClass
().
getResource
(
"maven-multimod-changes.zip"
)));
buildAndAssertSuccess
(
m
);
buildAndAssertSuccess
(
m
);
// Now run a second build with the changes.
// Now run a second build with the changes.
m
.
setIncrementalBuild
(
true
);
m
.
setIncrementalBuild
(
true
);
buildAndAssertSuccess
(
m
);
buildAndAssertSuccess
(
m
);
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
MavenModuleSetBuild
pBuild
=
m
.
getLastBuild
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
ExtractChangeLogSet
changeSet
=
(
ExtractChangeLogSet
)
pBuild
.
getChangeSet
();
assertFalse
(
"ExtractChangeLogSet should not be empty."
,
changeSet
.
isEmptySet
());
assertFalse
(
"ExtractChangeLogSet should not be empty."
,
changeSet
.
isEmptySet
());
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
String
parentModuleName
=
modBuild
.
getParent
().
getModuleName
().
toString
();
String
parentModuleName
=
modBuild
.
getParent
().
getModuleName
().
toString
();
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleA"
))
{
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleA"
))
{
assertEquals
(
"moduleA should have Result.NOT_BUILT"
,
Result
.
NOT_BUILT
,
modBuild
.
getResult
());
assertEquals
(
"moduleA should have Result.NOT_BUILT"
,
Result
.
NOT_BUILT
,
modBuild
.
getResult
());
}
}
else
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleB"
))
{
else
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleB"
))
{
assertEquals
(
"moduleB should have Result.SUCCESS"
,
Result
.
SUCCESS
,
modBuild
.
getResult
());
assertEquals
(
"moduleB should have Result.SUCCESS"
,
Result
.
SUCCESS
,
modBuild
.
getResult
());
}
}
else
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleC"
))
{
else
if
(
parentModuleName
.
equals
(
"org.jvnet.hudson.main.test.multimod:moduleC"
))
{
assertEquals
(
"moduleC should have Result.SUCCESS"
,
Result
.
SUCCESS
,
modBuild
.
getResult
());
assertEquals
(
"moduleC should have Result.SUCCESS"
,
Result
.
SUCCESS
,
modBuild
.
getResult
());
}
}
}
}
long
summedModuleDuration
=
0
;
long
summedModuleDuration
=
0
;
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
for
(
MavenBuild
modBuild
:
pBuild
.
getModuleLastBuilds
().
values
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录