Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
39a20e7a
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,发现更多精彩内容 >>
提交
39a20e7a
编写于
7月 25, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #200 from kutzi/maven-dep-graph-enhancement
Enhancements for Maven dependency graph
上级
a70e8675
315d2b61
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
4 deletion
+75
-4
changelog.html
changelog.html
+6
-0
maven-plugin/src/main/java/hudson/maven/MavenModule.java
maven-plugin/src/main/java/hudson/maven/MavenModule.java
+69
-4
未找到文件。
changelog.html
浏览文件 @
39a20e7a
...
...
@@ -70,6 +70,12 @@ Upcoming changes</a>
<li
class=
bug
>
Some CLI command are not available.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10418"
>
issue 10418
</a>
)
<li
class=
rfe
>
Maven jobs deploying or installing artifacts should be used for dependency graph instead of jobs which don't
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10366"
>
issue 10366
</a>
)
<li
class=
rfe
>
Maven jobs which are disabled should be excluded from dependency graph
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10367"
>
issue 10367
</a>
)
</ul>
</div>
<!--=TRUNK-END=-->
...
...
maven-plugin/src/main/java/hudson/maven/MavenModule.java
浏览文件 @
39a20e7a
...
...
@@ -40,6 +40,8 @@ import org.kohsuke.stapler.StaplerRequest;
import
org.kohsuke.stapler.StaplerResponse
;
import
org.kohsuke.stapler.export.Exported
;
import
com.google.common.util.concurrent.MoreExecutors
;
import
javax.servlet.ServletException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -387,7 +389,7 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
}
protected
void
buildDependencyGraph
(
DependencyGraph
graph
)
{
if
(
isDisabled
()
||
getParent
().
ignoreUpstremChanges
())
return
;
if
(
!
isBuildable
()
||
getParent
().
ignoreUpstremChanges
())
return
;
MavenDependencyComputationData
data
=
graph
.
getComputationalData
(
MavenDependencyComputationData
.
class
);
...
...
@@ -402,11 +404,13 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
Map
<
ModuleDependency
,
MavenModule
>
modules
=
new
HashMap
<
ModuleDependency
,
MavenModule
>();
for
(
MavenModule
m
:
Jenkins
.
getInstance
().
getAllItems
(
MavenModule
.
class
))
{
if
(
m
.
isDisabled
())
continue
;
if
(
!
m
.
isBuildable
())
continue
;
ModuleDependency
moduleDependency
=
m
.
asDependency
();
modules
.
put
(
moduleDependency
,
m
);
MavenModule
old
=
modules
.
get
(
moduleDependency
);
MavenModule
relevant
=
chooseMoreRelevantModule
(
old
,
m
,
moduleDependency
);
modules
.
put
(
moduleDependency
,
relevant
);
if
(
hasDependenciesWithUnknownVersion
)
{
modules
.
put
(
moduleDependency
.
withUnknownVersion
(),
m
);
modules
.
put
(
moduleDependency
.
withUnknownVersion
(),
relevant
);
}
}
data
=
new
MavenDependencyComputationData
(
modules
);
...
...
@@ -477,6 +481,67 @@ public final class MavenModule extends AbstractMavenProject<MavenModule,MavenBui
}
return
false
;
}
private
MavenModule
chooseMoreRelevantModule
(
MavenModule
mm1
,
MavenModule
mm2
,
ModuleDependency
moduleDependency
)
{
if
(
mm1
==
null
)
{
return
mm2
;
}
if
(
mm2
==
null
)
{
return
mm1
;
}
final
MavenModule
moreRelevant
;
final
MavenModule
lessRelevant
;
int
relevancy1
=
getDependencyRelevancy
(
mm1
);
int
relevancy2
=
getDependencyRelevancy
(
mm2
);
if
(
relevancy1
>
relevancy2
)
{
moreRelevant
=
mm1
;
lessRelevant
=
mm2
;
}
else
if
(
relevancy2
>
relevancy1
)
{
moreRelevant
=
mm2
;
lessRelevant
=
mm1
;
}
else
{
// arbitrary, but reproduceable
if
(
mm1
.
getParent
().
getName
().
compareTo
(
mm2
.
getParent
().
getName
())
<
0
)
{
moreRelevant
=
mm2
;
lessRelevant
=
mm1
;
}
else
{
// should always mean > 0 as name is unique
moreRelevant
=
mm1
;
lessRelevant
=
mm2
;
}
}
if
(
LOGGER
.
isLoggable
(
Level
.
FINER
))
{
LOGGER
.
finer
(
"Choosing "
+
moreRelevant
.
getParent
().
getName
()
+
" over "
+
lessRelevant
.
getParent
().
getName
()
+
" for module "
+
moduleDependency
.
getName
()
+
". Relevancies: "
+
relevancy1
+
", "
+
relevancy2
);
}
return
moreRelevant
;
}
private
int
getDependencyRelevancy
(
MavenModule
mm
)
{
int
relevancy
=
0
;
for
(
String
goal
:
Util
.
tokenize
(
mm
.
getGoals
()))
{
if
(
"deploy"
.
equals
(
goal
)
||
"deploy:deploy"
.
equals
(
goal
))
{
return
2
;
}
if
(
"install"
.
equals
(
goal
))
{
relevancy
=
1
;
}
}
for
(
Publisher
publisher
:
mm
.
getParent
().
getPublishers
())
{
if
(
publisher
instanceof
RedeployPublisher
)
{
return
2
;
}
}
return
relevancy
;
}
private
static
class
MavenDependencyComputationData
{
boolean
withUnknownVersions
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录