首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >远程http archetypeCatalog在Linux中不起作用

问远程http archetypeCatalog在Linux中不起作用
EN

Stack Overflow用户
提问于 2017-03-08 19:16:06
回答 1查看 288关注 0票数 0

我创建了一个Maven原型并上传到Nexus存储库。我可以用Windows上的"mvn archetype:generate -DarchetypeCatalog=http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml“命令基于这个原型生成一个项目。目录xml是有效的,我可以从浏览器手动打开。

现在,我在Linux上遵循相同的步骤,在conf/setting.xml中将服务器部分和存储库配置文件配置为与Windows相同的内容。maven报告“未定义目录。正在使用内部目录”。看起来麻雀没有读到“-DarchetypeCatalog=...”部分。

调试日志如下所示。Maven版本是3.3.9。这个问题在Redhat和Ubuntu上都有重现。希望任何人都能提出一个解决方案。谢谢。

代码语言:javascript
复制
[DEBUG] RuntimeInstance successfully initialized.
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate' with basic configurator -->
[DEBUG]   (f) archetypeCatalog = http://myhost:8080/nexus/content/repositories/my-snapshots/archetype-catalog.xml 
[DEBUG]   (f) basedir = /opt/testmaven
[DEBUG]   (f) interactiveMode = true
[DEBUG]   (f) localRepository =       id: local
      url: file:///root/.m2/repository/
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => true, update => always]

[DEBUG]   (f) remoteArtifactRepositories = [      id: my-snapshots
      url: http://myhost:8080/nexus/content/repositories/my-snapshots
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => false, update => always]
,       id: central
      url: https://repo.maven.apache.org/maven2
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@4943defe
[DEBUG] -- end configuration --
[INFO] Generating project in Interactive mode
[INFO] No catalog defined. Using internal catalog
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: internal -> org.apache.maven.archetypes:maven-archetype-archetype (An archetype which contains a sample archetype.)
.......
EN

回答 1

Stack Overflow用户

发布于 2017-03-14 21:15:34

在settings.xml中,我们需要配置一个镜像:

代码语言:javascript
复制
<mirrors>
  <mirror>
    <name>Local Nexus Mirror</name>
    <id>nexus</id>
    <mirrorOf>*</mirrorOf>
    <url>http://myhost:8080/nexus/content/groups/public</url>
  </mirror>
</mirrors>

一旦您将Nexus配置为所有存储库的镜像,Maven现在将咨询Nexus的本地安装,而不是转到中央Maven存储库。

如果Nexus具有所请求的工件,则将从本地Nexus安装提供该工件。

我们可以尝试在通过mvn archetype:generate生成maven工件时指定-DarchetypeCatalog=remote或-DarchetypeCatalog=local。

如果原型-cataog在本地可用,我们可以直接使用-Dcatalog=<url>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42669824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档