2015-01-21 73 views
2

我該如何強制Idea Intellij從Nexus存儲庫下載而不是Maven Public repo? 我在哪裏可以配置在創意屬性? 它沒有在pom.xml文件中定義,我不喜歡。在Idea Intellij中使用Nexus存儲庫代替公共Maven

+0

可能重複[Nexus和Maven的:訪問Maven的中央回購(http://stackoverflow.com/questions/16142763/nexus-and-maven-access-the-maven-central-repo) – 2015-01-22 20:28:00

+0

我認爲這是一個maven問題,而不是intellij問題。你接受的答案證明了這一點。我已經刪除了intellij標籤並投票將其作爲重複關閉。 – 2015-01-22 20:28:55

回答

6

不知道它是否也能在Idea Intellij上工作(我正在使用spring source studio-eclipse clon),但應該是因爲maven配置位於主目錄中的.M2目錄下的settings.xml中。只要使用這樣的事情(我的服務器NEXUS-服務器上運行:8081):

<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"> 
    <servers> 
    <server> 
     <id>releases</id> 
     <username>user-name</username> 
     <password>your-password</password> 
    </server> 
    <server> 
     <id>snapshots</id> 
     <username>user-name</username> 
     <password>your-password</password> 
    </server> 
    </servers> 
    <mirrors> 
     <mirror> 
      <!--This sends everything else to /public --> 
      <id>nexus</id> 
      <mirrorOf>*</mirrorOf> 
      <url>http://nexus-server:8081/nexus/content/groups/public</url> 
     </mirror> 
    </mirrors> 
    <profiles> 
     <profile> 
      <id>nexus</id> 
      <!--Disable 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> 
         <updatePolicy>always</updatePolicy> 
        </releases> 
        <snapshots> 
         <enabled>false</enabled> 
        </snapshots> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>central</id> 
        <url>http://central</url> 
        <releases> 
         <enabled>true</enabled> 
         <updatePolicy>always</updatePolicy> 
        </releases> 
        <snapshots> 
         <enabled>false</enabled> 
        </snapshots> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 
    <activeProfiles> 
     <!--make the profile active all the time --> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 
相關問題