我有两个项目。一个Maven和一个Gradle。该公司还具有一个内部Maven存储库。我正在尝试设置Gradle以使用内部存储库。使用Intellij 13,当我在build.gradle中向Gradle添加仓库时

build.gradle文件:

    apply plugin: 'java'
    apply plugin: 'war'

    sourceCompatibility = 1.5
    version = '1.0'

    maven {
            url "http://nexus.company.com/nexus/repo"
        }
        mavenLocal()
        mavenCentral()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }

gradle似乎完全忽略了.m2 / settings.xml(我尝试过不将Maven存储库添加到build.gradle文件中,并希望gradle将查看.m2 / settings.xml以确定从哪里获取 Artifact 。 )

.m2 / settings.xml文件
    <settings>
     <mirrors>
       <mirror>
         <id>nexus</id>
         <mirrorOf>*</mirrorOf>
         <url>http://nexus.company.com/nexus/repo</url>
       </mirror>
     </mirrors>


     <profiles>
       <profile>
             <id>central-repo</id>
             <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>central-repo</activeProfile>
    </activeProfiles>
</settings>

当回购被添加为http://nexus.company.com/nexus/repo时,Intellij永远在后台任务“正在处理索引”中旋转。没有它,一切就可以正常工作,只是内部构件无法下载。

但是,需要相同 Artifact 的maven项目将下载并在几秒钟内准备就绪。

我是新手。我有没有犯错?

最佳答案

对于“永远索引”,我使用了全新的IntelliJ安装,最终只需要等待15-20m @ 100%CPU,每个索引。在随后的发射中没有问题。

08-27 23:48
查看更多