Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
c1fc2055
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,发现更多精彩内容 >>
提交
c1fc2055
编写于
10月 10, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Dependency exclusion fix
Former-commit-id:
ebd64c48
上级
c07a55e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
60 deletion
+72
-60
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
...s/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
...e/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
+32
-21
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
...rg/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
...e/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
+8
-24
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
...src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
+28
-14
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/driver/DriverLibraryMavenArtifact.java
浏览文件 @
c1fc2055
...
...
@@ -220,7 +220,7 @@ public class DriverLibraryMavenArtifact extends DriverLibraryAbstract
}
if
(!
forceUpdate
)
{
MavenLocalVersion
localVersion
=
artifact
.
getActiveLocalVersion
();
if
(
localVersion
!=
null
&&
localVersion
.
getCacheFile
().
exists
()
)
{
if
(
localVersion
!=
null
)
{
// Already cached
return
localVersion
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifact.java
浏览文件 @
c1fc2055
...
...
@@ -254,6 +254,13 @@ public class MavenArtifact
}
public
MavenLocalVersion
resolveVersion
(
DBRProgressMonitor
monitor
,
String
versionRef
,
boolean
lookupVersion
)
throws
IOException
{
/*
MavenLocalVersion localVersion = getActiveLocalVersion();
if (localVersion != null && versionRef.equals(MavenArtifactReference.VERSION_PATTERN_RELEASE) || versionRef.equals(MavenArtifactReference.VERSION_PATTERN_LATEST)) {
// No need to lookup - we already have it
return localVersion;
}
*/
if
(
lookupVersion
&&
!
metadataLoaded
)
{
loadMetadata
(
monitor
);
}
...
...
@@ -261,30 +268,34 @@ public class MavenArtifact
String
versionInfo
=
versionRef
;
if
(
lookupVersion
)
{
List
<
String
>
allVersions
=
versions
;
if
(
versionInfo
.
equals
(
MavenArtifactReference
.
VERSION_PATTERN_RELEASE
))
{
versionInfo
=
releaseVersion
;
if
(!
CommonUtils
.
isEmpty
(
versionInfo
)
&&
isBetaVersion
(
versionInfo
))
{
versionInfo
=
null
;
}
}
else
if
(
versionInfo
.
equals
(
MavenArtifactReference
.
VERSION_PATTERN_LATEST
))
{
versionInfo
=
latestVersion
;
}
else
{
if
(
versionInfo
.
startsWith
(
"["
)
&&
versionInfo
.
endsWith
(
"]"
))
{
// Regex - find most recent version matching this pattern
String
regex
=
versionInfo
.
substring
(
1
,
versionInfo
.
length
()
-
1
);
try
{
Pattern
versionPattern
=
Pattern
.
compile
(
regex
);
List
<
String
>
versions
=
new
ArrayList
<
String
>(
allVersions
);
for
(
Iterator
<
String
>
iter
=
versions
.
iterator
();
iter
.
hasNext
();
)
{
if
(!
versionPattern
.
matcher
(
iter
.
next
()).
matches
())
{
iter
.
remove
();
switch
(
versionInfo
)
{
case
MavenArtifactReference
.
VERSION_PATTERN_RELEASE
:
versionInfo
=
releaseVersion
;
if
(!
CommonUtils
.
isEmpty
(
versionInfo
)
&&
isBetaVersion
(
versionInfo
))
{
versionInfo
=
null
;
}
break
;
case
MavenArtifactReference
.
VERSION_PATTERN_LATEST
:
versionInfo
=
latestVersion
;
break
;
default
:
if
(
versionInfo
.
startsWith
(
"["
)
&&
versionInfo
.
endsWith
(
"]"
))
{
// Regex - find most recent version matching this pattern
String
regex
=
versionInfo
.
substring
(
1
,
versionInfo
.
length
()
-
1
);
try
{
Pattern
versionPattern
=
Pattern
.
compile
(
regex
);
List
<
String
>
versions
=
new
ArrayList
<
String
>(
allVersions
);
for
(
Iterator
<
String
>
iter
=
versions
.
iterator
();
iter
.
hasNext
();
)
{
if
(!
versionPattern
.
matcher
(
iter
.
next
()).
matches
())
{
iter
.
remove
();
}
}
versionInfo
=
findLatestVersion
(
versions
);
}
catch
(
Exception
e
)
{
throw
new
IOException
(
"Bad version pattern: "
+
regex
);
}
versionInfo
=
findLatestVersion
(
versions
);
}
catch
(
Exception
e
)
{
throw
new
IOException
(
"Bad version pattern: "
+
regex
);
}
}
break
;
}
if
(
CommonUtils
.
isEmpty
(
versionInfo
))
{
if
(
allVersions
.
isEmpty
())
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
浏览文件 @
c1fc2055
...
...
@@ -142,6 +142,9 @@ public class MavenArtifactVersion {
}
public
List
<
MavenArtifactReference
>
findExclusionsFor
(
String
groupId
,
String
artifactId
)
{
if
(
dependencies
==
null
)
{
return
null
;
}
for
(
MavenArtifactDependency
dependency
:
dependencies
)
{
if
(
dependency
.
getGroupId
().
equals
(
groupId
)
&&
dependency
.
getArtifactId
().
equals
(
artifactId
))
{
return
dependency
.
getExclusions
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
浏览文件 @
c1fc2055
...
...
@@ -131,17 +131,22 @@ public class MavenRegistry
@Nullable
public
MavenArtifact
findArtifact
(
@NotNull
MavenArtifactReference
ref
)
{
return
findArtifact
(
ref
.
getGroupId
(),
ref
.
getArtifactId
());
return
findArtifact
(
ref
.
getGroupId
(),
ref
.
getArtifactId
()
,
true
);
}
@Nullable
private
MavenArtifact
findArtifact
(
@NotNull
String
groupId
,
@NotNull
String
artifactId
)
{
public
MavenArtifact
findArtifact
(
@NotNull
MavenArtifactReference
ref
,
boolean
resolve
)
{
return
findArtifact
(
ref
.
getGroupId
(),
ref
.
getArtifactId
(),
resolve
);
}
@Nullable
private
MavenArtifact
findArtifact
(
@NotNull
String
groupId
,
@NotNull
String
artifactId
,
boolean
resolve
)
{
String
fullId
=
groupId
+
":"
+
artifactId
;
if
(
notFoundArtifacts
.
contains
(
fullId
))
{
return
null
;
}
MavenArtifact
artifact
=
findInRepositories
(
groupId
,
artifactId
,
false
);
if
(
artifact
==
null
)
{
if
(
artifact
==
null
&&
resolve
)
{
artifact
=
findInRepositories
(
groupId
,
artifactId
,
true
);
}
if
(
artifact
!=
null
)
{
...
...
@@ -153,27 +158,6 @@ public class MavenRegistry
return
null
;
}
/*
@Nullable
public MavenLocalVersion findArtifactVersion(@NotNull MavenArtifactReference ref) {
String fullId = ref.getGroupId() + ":" + ref.getArtifactId();
if (notFoundArtifacts.contains(fullId)) {
return null;
}
MavenLocalVersion version = findInRepositories(groupId, artifactId, false);
if (version == null) {
version = findInRepositories(groupId, artifactId, true);
}
if (version != null) {
return version;
}
// Not found
notFoundArtifacts.add(fullId);
return null;
}
*/
public
void
resetArtifactInfo
(
MavenArtifactReference
artifactReference
)
{
String
groupId
=
artifactReference
.
getGroupId
();
String
artifactId
=
artifactReference
.
getArtifactId
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
浏览文件 @
c1fc2055
...
...
@@ -168,6 +168,7 @@ public class MavenRepository
String
path
;
MavenArtifactDependency
.
Scope
scope
;
boolean
optional
;
List
<
String
>
exclusions
;
DependencyResolveInfo
(
String
path
,
MavenArtifactDependency
.
Scope
scope
,
boolean
optional
)
{
this
.
path
=
path
;
...
...
@@ -210,6 +211,7 @@ public class MavenRepository
reader
.
parse
(
new
SAXListener
()
{
MavenArtifact
lastArtifact
;
VersionResolveInfo
lastVersionResolveInfo
;
DependencyResolveInfo
lastDependencyInfo
;
@Override
public
void
saxStartElement
(
SAXReader
reader
,
String
namespaceURI
,
String
localName
,
Attributes
atts
)
throws
XMLException
{
if
(
TAG_ARTIFACT
.
equals
(
localName
))
{
...
...
@@ -247,11 +249,17 @@ public class MavenRepository
log
.
debug
(
e
);
}
}
last
VersionResolveInfo
.
dependencies
.
add
(
new
DependencyResolveInfo
(
last
DependencyInfo
=
new
DependencyResolveInfo
(
atts
.
getValue
(
ATTR_PATH
),
scope
,
CommonUtils
.
getBoolean
(
atts
.
getValue
(
ATTR_OPTIONAL
),
false
)
));
);
lastVersionResolveInfo
.
dependencies
.
add
(
lastDependencyInfo
);
}
else
if
(
TAG_EXCLUDE
.
equals
(
localName
)
&&
lastDependencyInfo
!=
null
)
{
if
(
lastDependencyInfo
.
exclusions
==
null
)
{
lastDependencyInfo
.
exclusions
=
new
ArrayList
<>();
}
lastDependencyInfo
.
exclusions
.
add
(
atts
.
getValue
(
ATTR_PATH
));
}
}
@Override
...
...
@@ -264,6 +272,8 @@ public class MavenRepository
lastArtifact
=
null
;
}
else
if
(
TAG_VERSION
.
equals
(
localName
))
{
lastVersionResolveInfo
=
null
;
}
else
if
(
TAG_DEPENDENCY
.
equals
(
localName
))
{
lastDependencyInfo
=
null
;
}
}
});
...
...
@@ -279,29 +289,33 @@ public class MavenRepository
// Perform late resolution
for
(
VersionResolveInfo
vri
:
lateResolutions
)
{
if
(
vri
.
parentPath
!=
null
)
{
MavenLocalVersion
parentVersion
=
resolve
Local
Version
(
vri
.
parentPath
);
MavenLocalVersion
parentVersion
=
resolve
Cached
Version
(
vri
.
parentPath
);
if
(
parentVersion
!=
null
)
{
vri
.
localVersion
.
getMetaData
().
setParent
(
parentVersion
);
}
}
for
(
DependencyResolveInfo
dri
:
vri
.
dependencies
)
{
MavenLocalVersion
depVersion
=
resolveLocalVersion
(
dri
.
path
);
if
(
depVersion
!=
null
)
{
vri
.
localVersion
.
getMetaData
().
addDependency
(
new
MavenArtifactDependency
(
depVersion
.
getArtifact
().
getGroupId
(),
depVersion
.
getArtifact
().
getArtifactId
(),
depVersion
.
getVersion
(),
dri
.
scope
,
dri
.
optional
));
//MavenLocalVersion cachedVersion = resolveCachedVersion(dri.path);
MavenArtifactReference
reference
=
new
MavenArtifactReference
(
dri
.
path
);
MavenArtifactDependency
dependency
=
new
MavenArtifactDependency
(
reference
.
getGroupId
(),
reference
.
getArtifactId
(),
reference
.
getVersion
(),
dri
.
scope
,
dri
.
optional
);
if
(!
CommonUtils
.
isEmpty
(
dri
.
exclusions
))
{
for
(
String
path
:
dri
.
exclusions
)
{
dependency
.
addExclusion
(
new
MavenArtifactReference
(
path
));
}
}
vri
.
localVersion
.
getMetaData
().
addDependency
(
dependency
);
}
}
}
private
MavenLocalVersion
resolve
Local
Version
(
String
path
)
{
private
MavenLocalVersion
resolve
Cached
Version
(
String
path
)
{
MavenArtifactReference
parentRef
=
new
MavenArtifactReference
(
path
);
MavenArtifact
parentArtifact
=
MavenRegistry
.
getInstance
().
findArtifact
(
parentRef
);
MavenArtifact
parentArtifact
=
MavenRegistry
.
getInstance
().
findArtifact
(
parentRef
,
false
);
if
(
parentArtifact
==
null
)
{
log
.
warn
(
"Can't resolve artifact "
+
parentRef
);
return
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录