Maven - 将依赖项部署到远程存储库 [英] Maven - deploy dependencies to remote repository

查看:23
本文介绍了Maven - 将依赖项部署到远程存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个项目有很多 Maven 依赖项.当我调用命令 mvn deploy (或它的一些变体)时,我不仅希望将项目本身部署到远程存储库,而且还希望将其所有依赖项部署到远程存储库中.这可能吗?我在这个网站上看到很多类似的问题",但我似乎找不到任何像这样简单的东西.我所看到的其他所有东西似乎都需要一些额外的功能.我只是想将我的项目以及它的所有依赖项部署到远程存储库.我正在使用 Maven 编译器插件 1.5

I have a few projects with LOTS of maven dependencies. When I invoke the command mvn deploy (or some variation of it), I would like to not only have the project itself deployed to the remote repository, but also all of its dependencies as well. Is this possible? I see many 'similar questions' on this site, but I can't seem to find anything that is as simply put as this. Everything else I've seen seems to expect some additional functionality. I simply want to deploy my project, plus all of its dependencies to the remote repo. I'm using the maven compiler plugin 1.5

这是我的 settings.xml 的一个片段.知道我错过了什么吗?

This is a snippet of my settings.xml. Any idea what I'm missing?

<mirrors>
<mirror>
  <!--This is used to direct the public snapshots repo in the 
      profile below over to a different nexus group -->
  <id>nexus-public-snapshots</id>
  <mirrorOf>public-snapshots</mirrorOf>
  <url>http://{ourServer}/nexus/content/groups/public-snapshots</url>
</mirror>
<mirror>
  <!--This sends everything else to /public -->
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>
  <url>http://{ourServer}/nexus/content/groups/public</url>
</mirror>
  </mirrors>
<profiles>
<profile>
  <id>development</id>
  <repositories>
    <repository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
  </repositories>
 <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>
<profile>
  <!--this profile will allow snapshots to be searched when activated-->
  <id>public-snapshots</id>
  <repositories>
    <repository>
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
      <releases><enabled>false</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
  </repositories>
 <pluginRepositories>
    <pluginRepository>
      <id>public-snapshots</id>
      <url>http://public-snapshots</url>
      <releases><enabled>false</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>
</profile>
 </profiles>

提前致谢
~j

推荐答案

您可以从一个干净的本地存储库开始,尝试构建您的应用程序,对于任何依赖项失败,将该应用程序部署到您的公司存储库.这将确保您的应用程序需要的所有依赖项在您的应用程序构建和部署之前驻留在公司存储库中.

You could start with a clean local repository, attempt to build your application and for any dependency failure, deploy that application to your corporate repository. This would ensure that all the dependencies that your application needs resides in the corporate repository prior to your application getting built and deployed.

在此之前,您需要将本地存储库配置为镜像 central 和其他知名存储库,以便开源第三方库自动进入您的远程存储库,而不必手动已上传.

Prior to this, you would configure your local repository to mirror central and other well-known repositories, so that open source third-party libraries automatically get into your remote repository instead of having to be manually uploaded.

事实证明,您可能没有太多需要手动部署的第三方库.

It may turn out that you may not have too many third-party libraries which you would need to manually deploy.

这篇关于Maven - 将依赖项部署到远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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