简体   繁体   English

如何在IntelliJ IDEA中添加Nexus存储库索引?

[英]How to add Nexus repository index in IntelliJ IDEA?

We managed our maven repository using Sonatype Nexus, and in the ~.m2\\setting.xml, set 我们使用Sonatype Nexus管理我们的maven存储库,并在~.m2 \\ setting.xml中设置

<mirrorOf>*</mirrorOf>

to our Nexus repository. 到我们的Nexus存储库。

In IntelliJ IDEA "Settings-->Maven-->Repositories-->Indexed Maven repositories", there are one local repository and one remote central repository " http://repo1.maven.org/maven2 ". 在IntelliJ IDEA“设置 - > Maven - >存储库 - >索引的Maven存储库”中,有一个本地存储库和一个远程中央存储库“ http://repo1.maven.org/maven2 ”。 However, there seems to be no way to index Nexus repository. 但是,似乎没有办法索引Nexus存储库。

Without the index, I can't use the "Maven Artifact Search" inside IntelliJ IDEA, instead I have to search it in Nexus website, and then copy the dependency to the pom.xml, which is not quite convenient. 没有索引,我不能在IntelliJ IDEA中使用“Maven工件搜索”,而是我必须在Nexus网站上搜索它,然后将依赖项复制到pom.xml,这不太方便。

Can anybody tell me how to add Nexus repository index in IntelliJ IDEA, so that I can search artifacts inside IDEA? 任何人都可以告诉我如何在IntelliJ IDEA中添加Nexus存储库索引,以便我可以在IDEA中搜索工件吗?

below is my settings.xml: 下面是我的settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <name>My repository</name>
      <url>http://1.2.3.4:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>central</id>
          <name>My repository</name>
          <url>http://repo1.maven.org/maven2</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://repo1.maven.org/maven2</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

AFA I know this isn't possible, using IntelliJ IDEA 13.1. AFA我知道这是不可能的,使用IntelliJ IDEA 13.1。 The only Maven repositories that are supported are local or public ones, per the docs: https://www.jetbrains.com/idea/help/maven-repositories.html 根据以下文档,支持的唯一Maven存储库是本地或公共存储库: https//www.jetbrains.com/idea/help/maven-repositories.html

@CrazyCoder, correct me if I'm wrong... @CrazyCoder,如果我错了,请纠正我......

Related: Adding maven repo in IntelliJ 相关: 在IntelliJ中添加maven repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM