本文介绍了从使用Maven的Java API库检索Maven的神器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个Maven神器信息(GroupId的,artifactId的版本)我怎么能以编程方式(使用Java)从我的本地库检索神器?

If I have a Maven Artifact information (GroupId, ArtifactId, Version) how can I programmatically (using Java) retrieve that Artifact from my local repository?

具体来说,我需要能够连接到Maven仓库,并创建/检索org.apache.maven.artifact.Artifact这样我就可以检索与神器相关的文件。

Specifically, I need to be able to connect to the Maven Repository and create/retrieve a org.apache.maven.artifact.Artifact so I can retrieve the file associated with the Artifact.

我看着M2E源$ C ​​$ C,但MavenImpl.java(提供神器分辨率)是比什么,我需要更加复杂,这是很难理解如何连接到存储库的作品。

I have looked into m2e source code, but the MavenImpl.java (which provides Artifact resolution) is way more complex than what I need and it is difficult to understand how the connection to the repository works.

推荐答案

您可能会想看看的的例子。

You'll probably want to look at Aether. See the Wiki for examples.

这篇关于从使用Maven的Java API库检索Maven的神器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:54