开发者

Archetype Selection Using m2eclipse

开发者 https://www.devze.com 2023-03-28 02:33 出处:网络
I would like to create a new Maven project in Eclipse using an archetype using the New Maven Project wizard. At the \"Select an Archetype\" step, I have three catalogs to choose from: Nexus Indexer, I

I would like to create a new Maven project in Eclipse using an archetype using the New Maven Project wizard. At the "Select an Archetype" step, I have three catalogs to choose from: Nexus Indexer, Internal and Default 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. 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).

Why is the Nexus Indexer list empty? I've read some posts that the Nexus index needs to be updated, but not how to do this. 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. Any clarification is most welcome!

My setup:

  • Eclipse: Helios Service Release 2 (Build id: 20110218-0911)
  • Apache Maven 3.0.3
  • m2eclipse: 0.12.1.20110112-1712 (set up to use external Maven install)
  • Sonatype Nexus™ Open Source Edition, Version: 1.9.0.2

My local Maven settings.xml looks like this:

<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>centra开发者_运维百科l</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.

For more information : http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html

And for reference, here's a template 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号