简体   繁体   English

使用 m2eclipse 选择原型

[英]Archetype Selection Using m2eclipse

I would like to create a new Maven project in Eclipse using an archetype using the New Maven Project wizard.我想使用新 Maven 项目向导的原型在 Eclipse 中创建一个新的 Maven 项目。 At the "Select an Archetype" step, I have three catalogs to choose from: Nexus Indexer , Internal and Default Local .在“选择一个原型”步骤中,我有三个目录可供选择: Nexus IndexerInternalDefault Local I don't understand where the content for these catalogs should be coming from.我不明白这些目录的内容应该来自哪里。 If I click on the "Configure" button, they are all greyed out and I can't modify them.如果我点击“配置”按钮,它们都是灰色的,我无法修改它们。

Only the Internal catalog has any archetypes listed in it.只有Internal目录中列出了任何原型。 Where are these archetypes coming from?这些原型从何而来? It's not from my local Maven repository because the group/artifacts are not in it (and archetypes in the repo are not listed).它不是来自我的本地 Maven 存储库,因为组/工件不在其中(并且未列出存储库中的原型)。

Why is the Nexus Indexer list empty?为什么Nexus Indexer列表为空? I've read some posts that the Nexus index needs to be updated, but not how to do this.我已经阅读了一些需要更新 Nexus 索引的帖子,但不知道如何执行此操作。 Is this different than the repository indexes (which are scheduled to be updated daily).这与存储库索引(计划每天更新)不同吗?

As you can see, I'm a little confused about the whole catalog business and how Maven, m2eclipse and Nexus interact.如您所见,我对整个目录业务以及 Maven、m2eclipse 和 Nexus 如何交互感到有些困惑。 Any clarification is most welcome!任何澄清都是最受欢迎的!

My setup:我的设置:

  • Eclipse: Helios Service Release 2 (Build id: 20110218-0911) Eclipse:Helios 服务版本 2(内部版本 ID:20110218-0911)
  • Apache Maven 3.0.3 Apache Maven 3.0.3
  • m2eclipse: 0.12.1.20110112-1712 (set up to use external Maven install) m2eclipse:0.12.1.20110112-1712(设置为使用外部Maven安装)
  • Sonatype Nexus™ Open Source Edition, Version: 1.9.0.2 Sonatype Nexus™ 开源版,版本:1.9.0.2

My local Maven settings.xml looks like this:我的本地 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>

The default archetype catalog can contain new archetypes.默认原型目录可以包含新的原型。 It's a manual process, you've to add them to a custom.xml file within your ~/.m2 directory.这是一个手动过程,您必须将它们添加到 ~/.m2 目录中的 custom.xml 文件中。

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

And for reference, here's a template archetype-catalog.xml作为参考,这里有一个模板 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>

Additionally, here's a good link on SO about Archetypes: What are the URLs of all the Maven Archetype catalogs that you know about?此外,这是关于原型的一个很好的链接: 你知道的所有 Maven 原型目录的 URL 是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM