我有两个项目。一个 Maven 和一个 Gradle。该公司还有一个内部 Maven 存储库。我正在尝试设置 Gradle 以使用内部存储库。使用 Intellij 13,当我将像这样的存储库添加到 build.gradle 中的 Gradle 时
构建.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"
}
.m2/settings.xml 似乎被 gradle 完全忽略(我尝试不将 Maven 存储库添加到 build.gradle 文件中,并希望 gradle 会查看 .m2/settings.xml 以找出从哪里获取工件)
.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>
当 repo 被调用时,Intellij 在后台任务中永远旋转并显示“正在处理索引”http://nexus.company.com/nexus/repo http://nexus.company.com/nexus/repo被添加。没有它,一切都可以正常工作,只是内部工件无法下载。
但是,需要相同工件的 Maven 项目会在几秒钟内下载并准备就绪。
我对 gradle 很陌生。我有什么错误吗?
对于“永远索引”,我使用了全新的 IntelliJ 安装,最终只需等待 15 - 20m @100% CPU 每个索引。在随后的发射中没有出现任何问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)