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

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

问题描述

我有一些项目与LOTS的maven依赖关系。当我调用命令mvn deploy(或其中的一些变体)时,我不仅希望将项目本身部署到远程存储库,还可以将其全部依赖。这可能吗?我在这个网站上看到很多类似的问题,但我似乎找不到任何简单的说法。我看过的其他一切似乎都期待着一些额外的功能。我只是想将我的项目,加上所有的依赖项部署到远程备份。我正在使用maven编译器插件1.5



这是我的settings.xml的一个片段。任何想法我失踪了?

 < mirrors> 
< mirror>
<! - 这用于将
配置文件中的公共快照repo引导到不同的nexus组 - >
< id> nexus-public-snapshots< / id>
< mirrorOf> public-snapshots< / mirrorOf>
< url> http:// {ourServer} / nexus / content / groups / public-snapshots< / url>
< / mirror>
< mirror>
<! - 将其他所有内容发送到/ public - >
< id> nexus< / id>
< mirrorOf> *< / mirrorOf>
< url> http:// {ourServer} / nexus / content / groups / public< / url>
< / mirror>
< / mirrors>
<个人资料>
<个人资料>
< id>开发< / id>
< repositories>
< repository>
< id> central< / id>
< url> http:// center< / url>
< releases>< enabled> true< / enabled>< / releases>
< snapshots>< enabled> true< / enabled>< / snapshots>
< / repository>
< / repositories>
< pluginRepositories>
< pluginRepository>
< id> central< / id>
< url> http:// center< / url>
< releases>< enabled> true< / enabled>< / releases>
< snapshots>< enabled> true< / enabled>< / snapshots>
< / pluginRepository>
< / pluginRepositories>
< / profile>
<个人资料>
<! - 此配置文件将允许在激活时搜索快照 - >
< 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

解决方案

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



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



可能会导致您可能没有太多的第三方库,您需要手动部署。


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

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>

Thanks in advance
~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.

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天全站免登陆