但是,每当我配置我的Maven settings.xml以使用我的私有虚拟存储库时,我只能下载一些依赖项,这些依赖项可以从Maven Central获取和从中提取.如果我使用Artifactory的默认settings.xml(libs-release,libs-snapshot,plugins-release,plugins-snapshot和no virtual repository),那么我可以下载Maven Central上可用的所有依赖项以及我的项目所需的依赖项.
我在Windows服务器2012虚拟服务器上运行他们提供的Tomcat上的Artifactory v4.4.2.我没有在代理后面跑.我对Archiva没有这样的问题.
关于我的私有虚拟存储库设置,我有一个名为“test”的虚拟存储库,它是一个“通用”软件包类型.该存储库包含以下存储库:
> remote-repos
> libs-release
> libs-snapshot
>插件发布
>插件快照
> test-release-local
> test-snapshot-local
>公司发布 – 本地
> company-snapshot-local
列出的前5个repos是提供Artifactory的默认虚拟存储库repos.列出的最后4个回购是本地回购,它们是通用包类型.
我想我应该用镜子.
这是我正在使用的一个示例settings.xml(我的用户名和密码将填充在我保存到Maven conf文件夹的生成的settings.xml中):
<?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"> <servers> <server> <username>${security.getCurrentUsername()}</username> <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password> <id>central</id> </server> <server> <username>${security.getCurrentUsername()}</username> <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password> <id>snapshots</id> </server> </servers> <mirrors> <mirror> <mirrorOf>*</mirrorOf> <name>test</name> <url>http://localhost:8082/artifactory/test</url> <id>test</id> </mirror> </mirrors> <profiles> <profile> <repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>libs-release</name> <url>http://localhost:8082/artifactory/libs-release</url> </repository> <repository> <snapshots /> <id>snapshots</id> <name>libs-snapshot</name> <url>http://localhost:8082/artifactory/libs-snapshot</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>plugins-release</name> <url>http://localhost:8082/artifactory/plugins-release</url> </pluginRepository> <pluginRepository> <snapshots /> <id>snapshots</id> <name>plugins-snapshot</name> <url>http://localhost:8082/artifactory/plugins-snapshot</url> </pluginRepository> </pluginRepositories> <id>artifactory</id> </profile> </profiles> <activeProfiles> <activeProfile>artifactory</activeProfile> </activeProfiles> </settings>
我无法从Maven Central通过我的虚拟存储库提取的工件示例是poi-ooxml-schemas-3.10-FINAL.jar或许多Apache Maven插件.一旦删除镜像部分,我就可以从Maven Central下载所有依赖项.这对我来说毫无意义.我的虚拟存储库配置为包含remote-repos虚拟存储库,因此应该能够从Maven Central中提取所有内容.
我究竟做错了什么?
解决方法
在修复此问题之前,建议的解决方法是基于简单默认布局创建新的存储库布局.
所以,而不是简单的默认布局:
[orgPath] / [模块] / [模块] – [baseRev]( – [fileItegRev]).[EXT]
应该创建一个新的布局,如下所示:
[orgPath] / [模块] / [模块] – [baseRev] [EXT]
创建此新存储库布局后,可以将存储库的已定义布局更改为新创建的存储库布局.
这将解决您提到的行为.