查找 Maven 存储库中特定插件的可用版本列表?
给定 pom.xml 中的以下存储库 URL,我如何确定存储库中可用的 spring 和 hibernate 的最新版本? http://repo1.maven.org/maven2
Given the following repository URL from my pom.xml how can I determine what the latest versions of spring and hibernate are available in the repository?
http://repo1.maven.org/maven2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检索放置在工件目录中的
maven-metadata.xml
文件,例如 https://repo1.maven.org/maven2/com/sun/media/jai_codec/maven-metadata.xml 用于具有 groupIdcom 的工件.sun.media
和artifactIdjai_codec
。Retrieve the
maven-metadata.xml
file, placed in the artifact directory, e.g. https://repo1.maven.org/maven2/com/sun/media/jai_codec/maven-metadata.xml for an artifact with the groupIdcom.sun.media
and artifactIdjai_codec
.以编程方式还是手动?
由于存储库通过 HTTP 工作,您只需手动导航即可:
http://repo2.maven .org/maven2/org/springframework/spring/
http://repo2.maven.org/maven2/org/hibernate/hibernate/
http://repo2.maven.org/maven2/org/hibernate/hibernate-核心/
Programatically or just manually?
Since the repository works over HTTP you can just navigate it manually:
http://repo2.maven.org/maven2/org/springframework/spring/
http://repo2.maven.org/maven2/org/hibernate/hibernate/
http://repo2.maven.org/maven2/org/hibernate/hibernate-core/
正如 Robert 的回答所述,存储库中每个工件的 maven-metadata.xml 文件都包含您需要的版本信息。特别注意元数据中的 latest 和 release 元素。最新元素表示要发布的最后一个版本,但这可能不是您想要的版本。例如,它可以是旧版本的维护版本、候选版本或里程碑。发布版本表示最后发布的版本将被视为发布版本,因此通常您会希望采用此版本。
有关信息,Maven super POM 有一个特殊的 < strong>release-profile 配置文件,通过设置performRelease 属性(例如通过在命令行上传递-DperformRelease)来激活。除此之外,激活此属性将设置部署插件的 updateReleaseInfo 属性,以便在部署时更新元数据。
As Robert's answer says, the maven-metadata.xml file for each artifact in the repository holds the version information you need. In particular note the latest and release elements in the metadata. The latest element denotes the last version to be published, this may not be the version you want though. For example it could be a maintenance release to an older version, a release candidate, or a milestone. The release version denotes the last published version intended to be treated as a release, so generally you'd want to take this version.
For information the Maven super POM has a special release-profile profile, activated by setting the performRelease property (e.g. by passing -DperformRelease on the command line). Amongst other things, activating this property will set the updateReleaseInfo property of the deploy-plugin so that the metadata will be updated when you deploy.
根据实际用例,值得一看 http://www.mojohaus .org/versions-maven-plugin/
Depending on what the real use case is, it can be worth looking at http://www.mojohaus.org/versions-maven-plugin/