Maven原型:产生过多的选择 [英] Maven archetype:generate excessive number of choice

查看:120
本文介绍了Maven原型:产生过多的选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据maven 网站以及有关该网站的一些教程web,mvn archetype:generate可以选择大约36,而选择15是快速入门。在我设置 Nexus 之前,它一直在这样工作。现在我可以选择358,默认为97(我无法从我的dos提示中读取描述)。这两个选择是否相同?为什么现在我有这么多选择。如果我必须更改我的存储库设置,如何纠正它。我的maven版本是

According to maven site, and some tutorials on the web, mvn archetype:generate would give a choice of about 36, and selection 15 is the quick start. It was working this way until I setup Nexus . Now I get a choice of 358 with default as 97 (which I am could not read the description from my dos prompt). Is both choices are same? Why now I get these many choices. How to correct it if I have to change my repository setttings. My maven version is

Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.6.0_16
Java home: C:\Program Files\Java\jdk1.6.0_16\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows vista" version: "6.0" arch: "amd64" Family: "windows"

谢谢。

339: remote -> parallelj-archetype (ParallelJ is a Java framework for parallel computing. It provides flow modeling and execution.)
340: remote -> parancoe-pluginarchetype (-)
341: remote -> parancoe-webarchetype (-)
342: remote -> liftweb-archetype-blank (Archetype - blank project for liwftweb)
343: remote -> liftweb-archetype-hellolift (Archetype - hellolift sample liwftweb application)
344: remote -> scala-archetype-simple (The maven-scala-plugin is used for compiling/testing/running/documenting scala code in maven.)
345: remote -> slf4j-archetype (The slf4j Archetype)
346: remote -> flexmojos-archetypes-application (-)
347: remote -> flexmojos-archetypes-library (-)
348: remote -> flexmojos-archetypes-modular-webapp (-)
349: remote -> nexus-plugin-archetype (-)
350: remote -> spring-osgi-bundle-archetype (Spring OSGi Maven2 Archetype)
351: remote -> spring-ws-archetype (Spring Web Services Maven2 Archetype.)
352: remote -> trails-archetype (-)
353: remote -> trails-secure-archetype (-)
354: remote -> tynamo-archetype (-)
355: remote -> wicket-scala-archetype (Basic setup for a project that combines Scala and Wicket,
                depending on the Wicket-Scala project. Includes an example Specs
                test.)
356: remote -> wikbook.archetype (-)
357: remote -> circumflex-archetype (-)
358: remote -> javg-minimal-archetype (-)
Choose a number: 97:


推荐答案

我正在寻找相同的解决方案,我似乎找到了一个可用的解决方案,虽然它可能不适合所有人。

I was looking for the same solution and I seem to find a usable one, though it may not suit everyone.

想法是创造本地原型目录并指定您可能需要的所有原型。
这样你只会得到你感兴趣的选择。

The idea is to create a local archetype catalog and specify all archetypes you may need there. This way you'll get only choices you're interested.

当然你可能会发现你需要在那里添加新的原型,那么你'我需要回退到正常使用远程存储库或手动添加它。

Of course you may find you'll need to add new archetype there, then you'll need either to fallback to normal use of remote repository or add it by hand.

食谱:


  1. 使用

  1. Create the initial local catalog with

mvn archetype:crawl -Dcatalog =〜/ .m2 / archetype -catalog.xml

将目录列表仅从您的本地目录传递到原型:generate

Pass catalog list from only you're local catalog to archetype:generate

mvn archetype:generate -DarchetypeCatalog = local

你会看到类似这样的东西:

You will see something like this:

grim@blackbox:~/projects$ mvn archetype:generate -DarchetypeCatalog=local

[ ...bullshit... ]

Choose archetype:
1: local -> maven-archetype-quickstart (quickstart)
2: local -> maven-archetype-archetype (archetype)
3: local -> maven-archetype-webapp (webapp)
Choose a number: 1:

你可以制作通过在settings.xml中指定选项永久选项:

You can make the option permanent by specifying it in your settings.xml:

<profiles>

    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
           <archetypeCatalog>local</archetypeCatalog>
        </properties>
    </profile>

现在当你想要后备通常的Maven目录列表,运行它

Now when you want to fallback to usual Maven catalog list, run it as

mvn archetype:generate -DarchetypeCatalog=remote,local

您可以使用所有原型。

这篇关于Maven原型:产生过多的选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆