Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Nexus repository index in IntelliJ IDEA?

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>
like image 989
fengyun Avatar asked Feb 07 '14 12:02

fengyun


People also ask

How do I set up Nexus repository?

Setting Up Nexus Repository Manager OSS The first step is to download the repository manager. You can download it here for Windows, Linux, and OS X. After downloading the file, you will have to extract it. Find the folder that contains a bin folder.

How do I access Nexus repository?

Users with the nx-repository-view Privilege can access the left navigation item. Click on the Browse button in the main toolbar and then the left navigation Browse item to access the Browse feature.

How do I upload a Nexus repository to jar?

Click on "Browse Repositories," and you'll see a list of repositories. You will want to right click on the "3rd Party" repository and choose "Upload Artifact." You will then see an "Upload Artifact" form. Choose the JAR to upload, then populate the group id, artifact id, version, and other fields.


1 Answers

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

like image 73
Steve K Avatar answered Oct 10 '22 01:10

Steve K