Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
38313661
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38313661
编写于
5月 21, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#3476 Maven: artifact resolution fix (parent artifact in different repo)
上级
62f79053
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
35 deletion
+45
-35
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
...rg/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
+45
-35
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
浏览文件 @
38313661
...
...
@@ -58,6 +58,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
private
List
<
MavenArtifactVersion
>
imports
;
private
final
List
<
MavenArtifactLicense
>
licenses
=
new
ArrayList
<>();
private
final
List
<
MavenProfile
>
profiles
=
new
ArrayList
<>();
private
final
List
<
MavenRepository
>
repositories
=
new
ArrayList
<>();
private
GeneralUtils
.
IVariableResolver
propertyResolver
=
new
GeneralUtils
.
IVariableResolver
()
{
@Override
...
...
@@ -77,7 +78,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
}
String
value
=
profile
.
properties
.
get
(
name
);
if
(
value
!=
null
)
{
return
value
;
return
evaluateString
(
value
)
;
}
}
}
...
...
@@ -89,11 +90,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
this
.
artifact
=
artifact
;
this
.
version
=
version
;
try
{
loadPOM
(
monitor
);
}
catch
(
IOException
e
)
{
log
.
error
(
"Error loading artifact version POM: "
+
e
.
getMessage
());
}
loadPOM
(
monitor
);
}
@NotNull
...
...
@@ -261,6 +258,8 @@ public class MavenArtifactVersion implements IMavenIdentifier {
if
(
description
!=
null
)
{
description
=
TextUtils
.
compactWhiteSpaces
(
description
.
trim
());
}
repositories
.
addAll
(
parseRepositories
(
root
));
{
// Parent
Element
parentElement
=
XMLUtils
.
getChildElement
(
root
,
"parent"
);
...
...
@@ -304,7 +303,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
MavenProfile
defaultProfile
=
new
MavenProfile
(
DEFAULT_PROFILE_ID
);
defaultProfile
.
active
=
true
;
profiles
.
add
(
defaultProfile
);
parseProfile
(
monitor
,
defaultProfile
,
root
);
parseProfile
(
monitor
,
defaultProfile
,
root
,
true
);
{
// Profiles
...
...
@@ -313,7 +312,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
for
(
Element
profElement
:
XMLUtils
.
getChildElementList
(
licensesElement
,
"profile"
))
{
MavenProfile
profile
=
new
MavenProfile
(
XMLUtils
.
getChildElementBody
(
profElement
,
"id"
));
profiles
.
add
(
profile
);
parseProfile
(
monitor
,
profile
,
profElement
);
parseProfile
(
monitor
,
profile
,
profElement
,
false
);
}
}
}
...
...
@@ -321,7 +320,7 @@ public class MavenArtifactVersion implements IMavenIdentifier {
monitor
.
worked
(
1
);
}
private
void
parseProfile
(
DBRProgressMonitor
monitor
,
MavenProfile
profile
,
Element
element
)
{
private
void
parseProfile
(
DBRProgressMonitor
monitor
,
MavenProfile
profile
,
Element
element
,
boolean
isDefault
)
{
{
// Activation
Element
activationElement
=
XMLUtils
.
getChildElement
(
element
,
"activation"
);
...
...
@@ -362,30 +361,10 @@ public class MavenArtifactVersion implements IMavenIdentifier {
}
}
}
{
if
(!
isDefault
)
{
// Repositories
Element
repsElement
=
XMLUtils
.
getChildElement
(
element
,
"repositories"
);
if
(
repsElement
!=
null
)
{
for
(
Element
repElement
:
XMLUtils
.
getChildElementList
(
repsElement
,
"repository"
))
{
MavenRepository
repository
=
new
MavenRepository
(
XMLUtils
.
getChildElementBody
(
repElement
,
"id"
),
XMLUtils
.
getChildElementBody
(
repElement
,
"name"
),
XMLUtils
.
getChildElementBody
(
repElement
,
"url"
),
MavenRepository
.
RepositoryType
.
EXTERNAL
);
String
layout
=
XMLUtils
.
getChildElementBody
(
repElement
,
"layout"
);
if
(
"legacy"
.
equals
(
layout
))
{
log
.
debug
(
"Skip legacy repository ["
+
repository
+
"]"
);
continue
;
}
Element
releasesElement
=
XMLUtils
.
getChildElement
(
repElement
,
"releases"
);
if
(
releasesElement
==
null
)
{
continue
;
}
boolean
enabled
=
CommonUtils
.
toBoolean
(
XMLUtils
.
getChildElementBody
(
releasesElement
,
"enabled"
));
if
(
enabled
)
{
profile
.
addRepository
(
repository
);
}
}
for
(
MavenRepository
repository
:
parseRepositories
(
element
))
{
profile
.
addRepository
(
repository
);
}
}
{
...
...
@@ -398,6 +377,34 @@ public class MavenArtifactVersion implements IMavenIdentifier {
}
}
private
List
<
MavenRepository
>
parseRepositories
(
Element
element
)
{
List
<
MavenRepository
>
repositories
=
new
ArrayList
<>();
// Repositories
Element
repsElement
=
XMLUtils
.
getChildElement
(
element
,
"repositories"
);
if
(
repsElement
!=
null
)
{
for
(
Element
repElement
:
XMLUtils
.
getChildElementList
(
repsElement
,
"repository"
))
{
MavenRepository
repository
=
new
MavenRepository
(
XMLUtils
.
getChildElementBody
(
repElement
,
"id"
),
XMLUtils
.
getChildElementBody
(
repElement
,
"name"
),
XMLUtils
.
getChildElementBody
(
repElement
,
"url"
),
MavenRepository
.
RepositoryType
.
EXTERNAL
);
String
layout
=
XMLUtils
.
getChildElementBody
(
repElement
,
"layout"
);
if
(
"legacy"
.
equals
(
layout
))
{
log
.
debug
(
"Skip legacy repository ["
+
repository
+
"]"
);
continue
;
}
Element
releasesElement
=
XMLUtils
.
getChildElement
(
repElement
,
"releases"
);
boolean
enabled
=
releasesElement
==
null
||
CommonUtils
.
toBoolean
(
XMLUtils
.
getChildElementBody
(
releasesElement
,
"enabled"
));
if
(
enabled
)
{
repositories
.
add
(
repository
);
}
}
}
return
repositories
;
}
private
List
<
MavenArtifactDependency
>
parseDependencies
(
DBRProgressMonitor
monitor
,
Element
element
,
boolean
depManagement
)
{
List
<
MavenArtifactDependency
>
result
=
new
ArrayList
<>();
Element
dependenciesElement
=
XMLUtils
.
getChildElement
(
element
,
"dependencies"
);
...
...
@@ -538,19 +545,22 @@ public class MavenArtifactVersion implements IMavenIdentifier {
@NotNull
public
Collection
<
MavenRepository
>
getActiveRepositories
()
{
Map
<
String
,
MavenRepository
>
repositories
=
new
LinkedHashMap
<>();
Map
<
String
,
MavenRepository
>
result
=
new
LinkedHashMap
<>();
for
(
MavenRepository
rep
:
repositories
)
{
result
.
put
(
rep
.
getId
(),
rep
);
}
for
(
MavenArtifactVersion
v
=
MavenArtifactVersion
.
this
;
v
!=
null
;
v
=
v
.
parent
)
{
for
(
MavenProfile
profile
:
v
.
profiles
)
{
if
(
profile
.
isActive
())
{
List
<
MavenRepository
>
pr
=
profile
.
getRepositories
();
if
(
pr
!=
null
)
{
for
(
MavenRepository
repository
:
pr
)
{
re
positories
.
put
(
repository
.
getId
(),
repository
);
re
sult
.
put
(
repository
.
getId
(),
repository
);
}
}
}
}
}
return
re
positories
.
values
();
return
re
sult
.
values
();
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录