gpt4 book ai didi

java - DistributionManagement 和 Repositories 中的不同存储库

转载 作者:搜寻专家 更新时间:2023-11-01 02:06:12 24 4
gpt4 key购买 nike

<DistributionManagement> ... </DistributionManagement>
and <Repositories> ... <Repositories>
部分,可以有一个

<Repository> ... </Repository>

定义。这两个定义有什么区别?这是一个例子:

<distributionManagement>

<downloadUrl>https://github.com/marytts/marytts/releases</downloadUrl>
<repository>
<id>bintray</id>
<url>https://api.bintray.com/maven/marytts/marytts/marytts</url>
</repository>
<snapshotRepository>
<id>bintray</id>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>marytts-dependencies</id>
<name>marytts-dependencies</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.local.repository.path}</url>
</repository>
<repository>
<id>central</id>
<name>jcenter</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>

最佳答案

分销管理

Distribution management acts precisely as it sounds: it manages the distribution of the artifact and supporting files generated throughout the build process. Starting with the last elements first:

存储库

Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed. The repository elements will be used for snapshot distribution if the snapshotRepository is not defined.

使用存储库布局部署

要使用 Maven 布局部署文件,您应该定义分发管理位置:

<project>
...
<distributionManagement>
<repository>
<id>myrepository</id>
<url>file:D:/repository/</url>
</repository>
</distributionManagement>
</project>

然后你只需要执行下面的命令来让你的 Artifact 复制到你的文件系统位置

在本地文件系统中部署文件的Maven命令

mvn deploy

站点分布

More than distribution to the repositories, distributionManagement is responsible for defining how to deploy the project's site and documentation.

pom.xml , 配置在 distributionManagement 内部署站点的位置标签。

<distributionManagement>
<site>
<id>mkyongserver</id>
<url>dav:http://127.0.0.1/sites/</url>
</site>
</distributionManagement>

搬迁

Projects are not static; they are living things (or dying things, as the case may be). A common thing that happens as projects grow, is that they are forced to move to more suitable quarters. For example, when your next wildly successful open source project moves under the Apache umbrella, it would be good to give your users as heads-up that the project is being renamed to org.apache:my-project:1.0. Besides specifying the new address, it is also good form to provide a message explaining why.

存储库

Repositories are collections of artifacts which adhere to the Maven repository directory layout. In order to be a Maven repository artifact, a POM file must live within the structure $BASE_REPO/groupId/artifactId/version/artifactId-version.pom. $BASE_REPO can be local (file structure) or remote (base URL); the remaining layout will be the same. Repositories exist as a place to collect and store artifacts. Whenever a project has a dependency upon an artifact, Maven will first attempt to use a local copy of the specified artifact. If that artifact does not exist in the local repository, it will then attempt to download from a remote repository. The repository elements within a POM specify those alternate repositories to search.

The repository is one of the most powerful features of the Maven community. The default central Maven repository lives on http://repo.maven.apache.org/maven2/. Another source for artifacts not yet in iBiblio is the Codehaus snapshots repo.

请记住,您只能添加一个 <repository>和一个<snapshotRepository>里面的 child <distributionManagement>

如何声明代理

只需转到 Maven-> conf-> setting.xml文件和添加代理

<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>global.proxy.mycompany.com</host>
<port>8000</port>
<username></username>
<password></password>
<nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>
</proxy>
</proxies>

关于java - DistributionManagement 和 Repositories 中的不同存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32515410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com