Java – How to add Nexus repository index in IntelliJ IDEA

intellij-ideajavamaven

We managed our maven repository using Sonatype Nexus, and in the ~.m2\setting.xml, set

<mirrorOf>*</mirrorOf>

to our Nexus repository.

In IntelliJ IDEA "Settings–>Maven–>Repositories–>Indexed Maven repositories", there are one local repository and one remote central repository "http://repo1.maven.org/maven2". However, there seems to be no way to index Nexus repository.

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.

Can anybody tell me how to add Nexus repository index in IntelliJ IDEA, so that I can search artifacts inside IDEA?

below is my 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>

Best Answer

AFA I know this isn't possible, using 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

@CrazyCoder, correct me if I'm wrong...

Related: Adding maven repo in IntelliJ