And*_*uta 2 intellij-idea maven
我有一个Maven项目,镜像设置为centralrepo,就像这样:
<settings>
...
<mirrors>
<mirror>
<id>central-my</id>
<mirrorOf>central</mirrorOf>
<name>Maven Central Repo mirror</name>
<url>http://local_url:15999/nexus/content/repositories/central/</url>
</mirror>
</mirrors>
...
</settings>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,当我导入此项目为IDEA,使其使用settings.xml它仍然没有看到这面镜子,向我展示http://repo.maven.apache.org/maven2,而不是(Project Settings> Maven> Repositories).问题是,我无法从此回购更新,因为我在内部网络上.在这种情况下我该怎么办?
mirrorOf 不鼓励使用,因为它违背了为促销提供单独的存储库(例如从快照到登台到发布),访问控制等的想法.由于没有适当的二进制存储库,在市场上有多个存储库支持,因此Maven中存在此功能因此,Maven开发人员居住在世界上,其中一个代理为其代理的所有远程存储库公开了一个URL.那当然不再是真的.此设置的另一个用法是确保您的内部存储库不是依赖项的pom文件中的存储库声明的快捷方式,但是对于此问题也有更好的解决方案.
总而言之,不要使用mirrorOf.相反,你应该"阴影"中central和plugins仓库,与您的内部存储库URL替换它们.
以下是settings.xmlArtifactory 的一个示例(对于Nexus应该类似):
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-releases</name>
<url>http://jbaruch.artifactoryonline.com/jbaruch/libs-releases</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>remote-snapshot-repos</name>
<url>http://jbaruch.artifactoryonline.com/jbaruch/remote-snapshot-repos</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-releases</name>
<url>http://jbaruch.artifactoryonline.com/jbaruch/plugins-releases</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>http://jbaruch.artifactoryonline.com/jbaruch/plugins-snapshots</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1740 次 |
| 最近记录: |