运行Maven和Sonatype的的Nexus离线没有互联网连接,而 [英] Running Maven and Sonatype Nexus while offline with no internet connection

查看:429
本文介绍了运行Maven和Sonatype的的Nexus离线没有互联网连接,而的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个Maven环境关系,使Maven同时下载从本地的Nexus库的文物。在安装的Maven和Nexus该机有出于安全原因,没有互联网连接。

I am trying to setup a maven environment with nexus so that maven downloads its artifacts from a local Nexus repository. The machine where Maven and Nexus is installed has no internet connectivity for security reasons.

我有我的工作站上的类似配置里面确实有互联网连接。我安装了Maven和的Nexus在两台机器上。我也更新了我的本地Maven设置文件〜2 / settings.xml中,如下所示:

I have a similar configuration on my workstation which does have internet connectivity. I installed Maven and Nexus on both machines. I also updated my local maven settings file in ~m2/settings.xml as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <proxies></proxies>
  <servers></servers>
  <pluginGroups></pluginGroups>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <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>
  </profiles>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

我已经运行到运行一个简单的安全服务器上的MVN安装,并抱怨缺少的依赖关系。这是意料之中的,因为我还没有下载和上传任何文物到存储库。

I have run to run a simple "mvn install" on the secure server and it complained about missing dependencies. This is expected because i have not downloaded and uploaded any artifacts onto the repository.

我想用我的本地工作站下载神器,压缩起来并上传到了Nexus库的安全的机器上。我已经运行我的本地工作站上MVN安装',一切都已经被下载。现在我需要资源库中的本地工作站上复制到安全服务器。

I would like to download the artifacts using my local workstation, zip them up and then upload them on to the Nexus repository on the secure machine. I have run 'mvn install' on my local workstation and everything has been downloaded. Now i need to copy the repository on the local workstation to the secure server.

据Nexus的文件,文件夹 $ HOME / Sonatype的工作是存储的位置。

According to the Nexus documentation, the folder $HOME/sonatype-work is the "storage" location.


  • 这是文件夹,我需要复制到安全服务器,以复制资源库中的唯一文件夹?

  • 是否有任何其他的文件,我需要担心?例如配置文件?

  • 我注意到,在默认情况下,的Nexus禁用远程仓库。这是否意味着,如果我离开它,因为它是我不需要做任何事情来prevent它从中央存储库下载任何东西。

在此先感谢。

推荐答案

这是可能的本地资源库中的内容上传到Nexus服务器的存储区域。您可能需要重新索引或重新生成存储库的元数据(可通过Nexus的GUI调用任务)。

It's possible to upload the contents of your local repository to the Nexus server's storage area. You might need to re-index or regenerate the repositories metadata (tasks that can be invoked via the Nexus GUI).

不过....我会建议你考虑一个替代解决方案,这将最终导致更少的维护。

However.... I would recommend that you consider an alternative solution that will ultimately result in less maintenance.

的Nexus的专业版具有采购套件有可使您能够创建库,其内容是由规则控制或基于参考版本。

The Professional edition of Nexus has procurement suite feature that enables you to create repositories whose content is controlled by rules or based on a reference build.

打开防火墙,以便只的Nexus接入互联网。使您能够给开发受控访问任何第三方的Nexus存储库。

Open up the firewall so that only Nexus has access to the internet. enables you to give development controlled access to any 3rd party Nexus repository.

这篇关于运行Maven和Sonatype的的Nexus离线没有互联网连接,而的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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