Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
216 views
in Technique[技术] by (71.8m points)

java - 如何使Maven解析器jar加载?(How can I make maven resolver jar be loaded?)

In order to check how maven get the dependency tree info, I looked into the maven code.

(为了检查maven如何获取依赖树信息,我研究了maven代码。)

I found that there is a log - "Dependency collection stats:" from the output of mvn dependency:tree -X is from maven-resolver project, so I downloaded the code and modify the log info to "Mytest Dependency collection stats:" (in file DefaultDependencyCollector.java), then build the jar - maven-resolver-impl-1.4.1.jar and use it to replace the one in my local maven repository(which located in .m2/repository/org/apache/maven/resolver/maven-resolver-impl/1.4.1/maven-resolver-impl-1.4.1.jar).

(我发现从mvn dependency:tree -X的输出中有一个日志- “ Dependency collection stats:” ,来自maven-resolver项目,因此我下载了代码并将日志信息修改为“ Mytest Dependency collection stats:” (在文件DefaultDependencyCollector.java中),然后构建jar-maven-resolver-impl-1.4.1.jar并使用它替换我本地的maven存储库(位于.m2 / repository / org / apache / maven /解析器/maven-resolver-impl/1.4.1/maven-resolver-impl-1.4.1.jar)。)

Then I do mvn dependency:tree -X again, but the output log still remains to be "Dependency collection stats:" .

(然后我再次执行mvn dependency:tree -X ,但是输出日志仍然是“ Dependency collection stats:” 。)

Why is my modification doesn't take effect and how should I make it work?

(为什么我的修改没有生效,我应该如何使它生效?)

Below is part of my maven output log that contains "Dependency collection stats:" .

(以下是我的maven输出日志的一部分,其中包含“依赖项收集状态:” 。)

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ dependencies-reading ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=814600, ConflictMarker.markTime=367100, ConflictMarker.nodeCount=297, ConflictIdSorter.graphTime=390100, ConflictIdSorter.topsortTime=85800, ConflictIdSorter.conflictIdCount=63, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=4345400, ConflictResolver.conflictItemCount=167, DefaultDependencyCollector.collectTime=886684200, DefaultDependencyCollector.transformTime=6158200}
[DEBUG] org.apache.maven.plugins:maven-dependency-plugin:jar:2.8
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.9:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.9:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.9:compile
  ask by user1726366 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...