gpt4 book ai didi

java - 使用 m2eclipse 选择原型(prototype)

转载 作者:搜寻专家 更新时间:2023-11-01 00:58:15 24 4
gpt4 key购买 nike

我想使用原型(prototype)在 Eclipse 中使用新建 Maven 项目向导创建一个新的 Maven 项目。在“选择原型(prototype)”步骤中,我有三个目录可供选择:Nexus IndexerInternalDefault Local。我不明白这些目录的内容应该来自哪里。如果我点击“配置”按钮,它们都是灰色的,我无法修改它们。

只有 Internal 目录中列出了任何原型(prototype)。这些原型(prototype)来自哪里?它不是来 self 的本地 Maven 存储库,因为组/Artifact 不在其中(并且未列出存储库中的原型(prototype))。

为什么 Nexus Indexer 列表是空的?我读过一些帖子说 Nexus 索引需要更新,但不知道如何更新。这与存储库索引(计划每天更新)不同吗?

如您所见,我对整个目录业务以及 Maven、m2eclipse 和 Nexus 的交互方式有些困惑。欢迎任何澄清!

我的设置:

  • Eclipse:Helios 服务版本 2(构建 ID:20110218-0911)
  • Apache Maven 3.0.3
  • m2eclipse:0.12.1.20110112-1712(设置为使用外部 Maven 安装)
  • Sonatype Nexus™ 开源版,版本:1.9.0.2

我的本​​地 Maven settings.xml 如下所示:

<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://myserver:8080/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<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>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<servers>
<server>
<id>my-snapshots</id>
<username>user</username>
<password>password</password>
</server>
<server>
<id>my-releases</id>
<username>user</username>
<password>password</password>
</server>
</servers>
</settings>

最佳答案

默认原型(prototype)目录可以包含新原型(prototype)。这是一个手动过程,您必须将它们添加到 ~/.m2 目录中的自定义 .xml 文件。

更多信息:http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html

作为引用,这里有一个模板 archetype-catalog.xml

<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog>
<archetypes>
<archetype>
<groupId>com.spedge</groupId>
<artifactId>archetype-application-custom-filter</artifactId>
<version>1.0-SNAPSHOT</version>
</archetype>
</archetypes>
</archetype-catalog>

此外,这里有一个关于原型(prototype)的很好的链接:What are the URLs of all the Maven Archetype catalogs that you know about?

关于java - 使用 m2eclipse 选择原型(prototype),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7071700/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com