当我在本地存储库中没有公司pom时,Maven mirrorOf *设置没有帮助我。但是,settings.xml中的存储库条目确实有效。是mirrorOf *失败的预期行为,还是一个bug?
例如,给定一个空的本地存储库和这个settings.xml文件,该文件应该将所有内容重定向到我们的公司存储库(其中包含我们的公司pom):
<settings>
<mirrors>
<mirror>
<id>bootstrap-repository</id>
<name>Bootstrap Repository</name>
<url>http://myinternalhost/path</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
并且给出了一个宣称公司pom为其父母的项目pom:
<parent>
<groupId>com.mycorp</groupId>
<artifactId>my-corporate-pom</artifactId>
<version>1.0.0-DNAPSHOT</version>
</parent>
在项目中调用Maven时,我在Eclipse中遇到此错误:
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\me\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Could not find metadata com.mycorp:my-corporate-pom:1.0.0-SNAPSHOT/maven-metadata.xml in local (C:\Users\me\.m2\repository)
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.mycorp:myproj:1.0.0-SNAPSHOT: Could not find artifact com.mycorp:my-corporate-pom:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 4, column 10
@
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.mycorp:myproj:1.0.0-SNAPSHOT: Could not find artifact com.mycorp:my-corporate-pom:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 4, column 10
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
然而,调用Maven成功 - 发现公司pom,下载到本地存储库,并用作我项目的父级 - 当我更改我的settings.xml文件以直接包含存储库时,如下所示:< / p>
<settings>
<profiles>
<profile>
<activation>
<property>
<name>!skip-corp-repository</name>
</property>
</activation>
<repositories>
<repository>
<id>corp-download-repository</id>
<name>Corporate Download Repository</name>
<url>http://myinternalhost/path</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>
是否存在mirrorOf *预期行为的失败,还是一个错误?