2011-08-15 47 views
5

我想在Eclipse中使用New Maven Project嚮導使用原型創建一個新的Maven項目。在「選擇原型」步驟中,我有三個目錄可供選擇:Nexus Indexer,InternalDefault Local。我不明白這些目錄的內容應該來自哪裏。如果我點擊「配置」按鈕,它們全都變灰,我不能修改它們。使用m2eclipse選擇原型

只有Internal目錄中列出了任何原型。這些原型從哪裏來?這不是來自我的本地Maven倉庫,因爲組/工件不在其中(並且未列出倉庫中的原型)。

爲什麼Nexus Indexer列表爲空?我讀過一些帖子,Nexus索引需要更新,但不是如何做到這一點。這是否與存儲庫索引(計劃每天更新)不同?如您所見,我對整個目錄業務以及Maven,m2eclipse和Nexus如何交互有點困惑。任何澄清是最受歡迎的!

我的設置:

  • 的Eclipse:赫利俄斯服務版本2(編譯號: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> 
+0

嗯,我因爲我在創建Tapestry項目時遇到困難,所以我希望看到答案,它應該列出,但不是,我不知道如何修復它,好可惜! –

回答

0

默認的原型目錄可以包含新的原型。這是一個手動過程,您必須將它們添加到〜/ .m2目錄中的自定義.xml文件中。

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

以供參考,這裏有一個模板原型,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> 

此外,這裏的一對SO有關原型一個很好的鏈接:What are the URLs of all the Maven Archetype catalogs that you know about?