Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
0943a3aa
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,发现更多精彩内容 >>
提交
0943a3aa
编写于
11月 18, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use utility methods for Maven version comparisons
上级
796918da
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
18 deletion
+44
-18
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
+1
-1
maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java
...gin/src/main/java/hudson/maven/MavenBuildInformation.java
+28
-0
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+2
-3
maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
.../main/java/hudson/maven/reporters/MavenFingerprinter.java
+13
-14
未找到文件。
maven-plugin/src/main/java/hudson/maven/MavenBuild.java
浏览文件 @
0943a3aa
...
...
@@ -660,7 +660,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
LOGGER
.
fine
(
getFullDisplayName
()+
" is building with mavenVersion "
+
mavenVersion
+
" from file "
+
mavenInformation
.
getVersionResourcePath
());
boolean
maven3orLater
=
new
ComparableVersion
(
mavenVersion
).
compareTo
(
new
ComparableVersion
(
"3.0"
)
)
>=
0
;
boolean
maven3orLater
=
MavenUtil
.
maven3orLater
(
mavenVersion
)
;
ProcessCache
.
MavenProcess
process
=
MavenBuild
.
mavenProcessCache
.
get
(
launcher
.
getChannel
(),
listener
,
maven3orLater
?
new
Maven3ProcessFactory
(
...
...
maven-plugin/src/main/java/hudson/maven/MavenBuildInformation.java
浏览文件 @
0943a3aa
...
...
@@ -22,6 +22,9 @@ package hudson.maven;
import
java.io.Serializable
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.maven.artifact.versioning.ComparableVersion
;
/**
* @author Olivier Lamy
* @since 1.392
...
...
@@ -39,4 +42,29 @@ public class MavenBuildInformation implements Serializable {
{
return
mavenVersion
;
}
/**
* @since 1.441
*/
public
boolean
isMaven3OrLater
()
{
return
MavenUtil
.
maven3orLater
(
mavenVersion
);
}
/**
* Returns if this maven version is at least 'version'.
* @param version the version to compare against
*
* @since 1.441
*/
public
boolean
isAtLeastMavenVersion
(
String
version
)
{
if
(
StringUtils
.
isBlank
(
mavenVersion
))
{
return
false
;
}
return
new
ComparableVersion
(
mavenVersion
).
compareTo
(
new
ComparableVersion
(
version
))
>=
0
;
}
@Override
public
String
toString
()
{
return
mavenVersion
;
}
}
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
0943a3aa
...
...
@@ -701,8 +701,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
ProcessCache
.
MavenProcess
process
=
null
;
boolean
maven3orLater
=
MavenUtil
.
maven3orLater
(
mavenVersion
);
boolean
maven3orLater
=
mavenBuildInformation
.
isMaven3OrLater
();
if
(
maven3orLater
)
{
LOGGER
.
fine
(
"using maven 3 "
+
mavenVersion
);
...
...
@@ -1190,7 +1189,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
// FIXME handle 3.1 level when version will be here : no rush :-)
// or made something configurable tru the ui ?
ReactorReader
reactorReader
=
null
;
boolean
maven3OrLater
=
new
ComparableVersion
(
mavenVersion
).
compareTo
(
new
ComparableVersion
(
"3.0"
)
)
>=
0
;
boolean
maven3OrLater
=
MavenUtil
.
maven3orLater
(
mavenVersion
)
;
if
(
maven3OrLater
)
{
mavenEmbedderRequest
.
setValidationLevel
(
ModelBuildingRequest
.
VALIDATION_LEVEL_MAVEN_3_0
);
}
else
{
...
...
maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
浏览文件 @
0943a3aa
...
...
@@ -26,6 +26,7 @@ package hudson.maven.reporters;
import
hudson.Extension
;
import
hudson.FilePath
;
import
hudson.maven.MavenBuild
;
import
hudson.maven.MavenBuildInformation
;
import
hudson.maven.MavenBuildProxy
;
import
hudson.maven.MavenBuildProxy.BuildCallable
;
import
hudson.maven.MavenModule
;
...
...
@@ -142,11 +143,9 @@ public class MavenFingerprinter extends MavenReporter {
File
parentFile
=
parent
.
getFile
();
if
(
parentFile
==
null
)
{
String
mavenVersion
=
build
.
getMavenBuildInformation
().
getMavenVersion
();
// Parent artifact contains no actual file, so we resolve against
// the local repository
ArtifactRepository
localRepository
=
getLocalRepository
(
mavenVersion
,
parent
,
pom
);
ArtifactRepository
localRepository
=
getLocalRepository
(
build
.
getMavenBuildInformation
()
,
parent
,
pom
);
if
(
localRepository
!=
null
)
{
Artifact
parentArtifact
=
getArtifact
(
parent
);
// Don't use ArtifactRepository.find(), for compatibility with Maven 2.x
...
...
@@ -179,18 +178,18 @@ public class MavenFingerprinter extends MavenReporter {
return
art
;
}
private
ArtifactRepository
getLocalRepository
(
String
mavenVers
ion
,
MavenProject
parent
,
MavenProject
pom
)
{
if
(
mavenVersion
.
startsWith
(
"2.0"
)
||
mavenVersion
.
startsWith
(
"2.1"
))
{
// Maven 2.0 has no corresponding mechanism
return
null
;
}
else
if
(
mavenVersion
.
startsWith
(
"2.2"
))
{
// principally this should also work with Maven 2.1, but it's not tested, so err on the safe side
return
getArtifactRepositoryMaven21
(
pom
);
}
else
if
(
mavenVersion
.
startsWith
(
"3."
)
||
mavenVersion
.
startsWith
(
"4."
)
/* who knows? ;) */
)
{
return
parent
.
getProjectBuildingRequest
()
.
getLocalRepository
()
;
private
ArtifactRepository
getLocalRepository
(
MavenBuildInformation
mavenBuildInformat
ion
,
MavenProject
parent
,
MavenProject
pom
)
{
if
(
mavenBuildInformation
.
isMaven3OrLater
())
{
return
parent
.
getProjectBuildingRequest
().
getLocalRepository
()
;
}
else
if
(
mavenBuildInformation
.
isAtLeastMavenVersion
(
"2.2"
))
{
// principally this should also work with Maven 2.1, but it's not tested, so err on the safe side
return
getArtifactRepositoryMaven21
(
pom
);
}
else
if
(
mavenBuildInformation
.
isAtLeastMavenVersion
(
"2.0"
)
)
{
// Maven 2.0 has no corresponding mechanism
return
null
;
}
else
{
LOGGER
.
warning
(
"Unknown Maven version: "
+
maven
Version
);
LOGGER
.
warning
(
"Unknown Maven version: "
+
maven
BuildInformation
.
getMavenVersion
()
);
return
null
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录