存储库与插件 [英] repository vs. pluginRepository

查看:89
本文介绍了存储库与插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前在几个地方都问过这个问题.

This has been asked before in few places.

但是答案很模糊.

所以我再问一次.

Apache Maven在 http://maven中说. apache.org/ref/3.5.0/maven-model/maven.html

The Apache Maven says in http://maven.apache.org/ref/3.5.0/maven-model/maven.html

  • 存储库/存储库*列表(许多) 远程存储库,用于发现依赖关系和扩展.
  • pluginRepositories/pluginRepository *列表(许多) 远程存储库列表,用于发现构建插件 和报告.
  • repositories/repository* List (Many) The lists of the remote repositories for discovering dependencies and extensions.
  • pluginRepositories/pluginRepository* List (Many) The lists of the remote repositories for discovering plugins for builds and reports.

但是有人可以解释一下这是什么.我发现了依赖项.但是所谓的发现用于构建和报告的插件".和发现扩展名"?

But can some one explain what that is. I get the discovery of dependencies. but what is meant by "discovering plugins for builds and reports." and " discovering of extensions" ?

推荐答案

PluginRepository是maven在其中搜索maven插件的地方.这就是为什么它提到构建(构建生命周期)和报告(站点生命周期)的原因.例如.这就是maven-compile-pluginmaven-surefire-plugin存在的地方

The PluginRepository is where maven searches for maven plugins. That is why it mentions builds (the build lifecycle) and reports (the site lifecycle). E.g. that is where the maven-compile-plugin and maven-surefire-plugin exists

常规存储库用于应用程序的依赖关系,即<dependencies><dependencyManagement>部分.它可以是您的junitcommons-logging或您需要的任何jar.

The normal repository is used for dependencies for your application, i.e. the sections <dependencies> and <dependencyManagement>. It could be your junit or commons-logging or whichever jar you needed.

通常,它们都可以指向相同的存储库,实际上,默认情况下,它们都指向Maven Central,但是您可以在其中拥有一些特殊的位置,或者对存储库使用不同的更新策略.

Normally they could both point to the same repositories and in fact by default, they both point to Maven Central, but you could have some special locations you needed in there, or alternatively have different update policies on the repositories.

我在spring项目中找到了一个示例,在其中您可以看到它们都在使用中(在底部):

I found an example in a spring project, where you can see them both being used (at the bottom): https://github.com/spring-projects/spring-data-jpa/blob/master/pom.xml

<repositories>
    <repository>
        <id>spring-libs-snapshot</id>
        <url>https://repo.spring.io/libs-snapshot</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-plugins-release</id>
        <url>https://repo.spring.io/plugins-release</url>
    </pluginRepository>
</pluginRepositories>

它们指向两个单独的URL,因此maven插件和依赖项实际上来自两个不同的地方

They are pointing to two separate URLs, so the maven plugins and dependencies are taken from essentially two different places

这篇关于存储库与插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆