maven archetype:generate 的进一步理解

可以说纠结了不少时间了

用mvn archetyoe:generate 时总是会出现以下的情况:

 

正常的应该是

 

$ mvn archetype:generate
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:create] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate]
Choose archetype:
1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC)
...........
internal -> maven-archetype-sar (JBoss Service Archive)
36: internal -> wicket-archetype-quickstart (A simple Apache Wicket project)
Choose a number:  (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36): 15
....

 

 

以前使用一直正常(有一段时间了)

可现在无论在哪台机器上都是这样的情况:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> docbkx-quickstart-archetype (null)
2: remote -> gquery-archetype (null)
.......
288: remote -> trails-secure-archetype (null)
289: remote -> tynamo-archetype (null)
290: 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.)
291: remote -> circumflex-archetype (null)
Choose a number: 80:
....

  

居然是这样,到了290了....

而且choose a nubmer 默认写了个80不知道啥意思..... 选以前的web项目(18) 不管用还是继续让我choose version

最后发现可以choose的version 只有 1 和2 ..

根本没有普通java项目和web项目

咋回事儿?

 

 

 

 

 后来找到了解决方案:

方案1:绕行

mvn archetype:create -DgroupId=[your group id] -DartifactId=[your archetype id] -DarchetypeArtifactId=maven-archetype-webapp

  

方案2 : 谢谢,juvenshun 大哥的帮助。(引用):

可以使用 $mvn archetype:generate -DarchetypeCatalog=internal
archetypeCatalog表示插件使用的archetype元数据,默认值为remote,local,即中央仓库archetype元数据(http://repo1.maven.org/maven2/archetype-catalog.xml)加上插件内置元数据的和
由于中央仓库的archetype太多,导致这个列表太长
因此自己指定仅用内置元数据(20个左右,好像),就可以解决你的烦恼了

 

 

你可能感兴趣的:(spring,maven,scala,Appfuse,wicket)