问题描述
是您可以快速生成的模板给定框架或项目类型的运行示例。我正在尝试编制目前在网上活动的所有Maven原型目录的列表。
Maven Archetypes are the "templates" by which you can quickly generate a running example of a given framework or project type. I am trying to compile a list of all the Maven archetype catalogs currently active on the net.
:
目录是xml文件。
Archetype插件捆绑了
和内部目录。这个是默认使用的
。
The Archetype Plugin comes bundled with an internal catalog. This one is used by default.
Archetype插件可以使用来自本地文件系统和HTTP
连接的目录
。
The Archetype Plugin can use catalogs from local filesystem and from HTTP connections.
到目前为止,我已经收集了这个发布目录的存储库列表,但是很想知道是否有人知道更多:
So far, I've gathered this list of repositories that do publish catalogs, but would love to see if anyone knows of more:
mvn archetype:generate
-DarchetypeCatalog=local
-DarchetypeCatalog=remote
-DarchetypeCatalog=http://repo.fusesource.com/maven2
-DarchetypeCatalog=http://cocoon.apache.org
-DarchetypeCatalog=http://download.java.net/maven/2
-DarchetypeCatalog=http://myfaces.apache.org
-DarchetypeCatalog=http://tapestry.formos.com/maven-repository
-DarchetypeCatalog=http://scala-tools.org
-DarchetypeCatalog=http://www.terracotta.org/download/reflector/maven2/
链接到:
1)
2)
3)
4)
5)
6)
7 )
Links to same:1) FuseSource2) Cocoon3) Java.net4) MyFaces5) Tapestry6) Scala Catalog7) Terracotta Catalog
您会注意到,如果存储库实际发布了原型目录(以上所有内容),您将获得在该 archetype-catalog中找到的所有选项的UI提示。 XML
。例如:
You'll notice that if the repository actually publishes an archetype catalog (all of the above do), you'll get a UI prompt of all the choices found in that archetype-catalog.xml
. For example:
mvn archetype:generate -DarchetypeCatalog=http://scala-tools.org
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://scala-tools.org -> scala-archetype-simple (A simple scala project)
2: http://scala-tools.org -> lift-archetype-blank (A blank/empty liftweb project)
3: http://scala-tools.org -> lift-archetype-basic (A basic liftweb project (with DB, css, ...))
Choose a number: (1/2/3):
例如,如果要直接查看Scala目录文件,可以
If you want to view the Scala catalog file directly for example, you can browse to http://scala-tools.org/archetype-catalog.xml
但是如果存储库没有提供一个archetype-catalog.xml,就像PascalT所说的那样,你需要事先知道这个名字(更不方便)并在命令行参数中传递它。
But if the repository doesn't provide an archetype-catalog.xml, then just as PascalT says, you'll need to know the name in advance (much less convenient) and pass it in command line arguments.
推荐答案
编辑:在马修澄清原型之后目录。
after Matthew clarification on archetype's catalogs.
我误解了一些概念,我的回答并不明确和正确。
I misunderstood some concepts and my answer isn't clear and correct.
目录的重点是不必事先知道原型的名称。它们用于发布原型并允许 mvn archetype:generate
列出原型。因此,在使用 mvn archetype:generate
时,添加外部目录(不在内部理解)以获得更广泛的已知原型列表是有意义的。
The point of catalogs is exactly to not have to know the names of archetypes in advance. They are made to publish archetypes and allow mvn archetype:generate
to list archetypes. So it makes sense to add "external" catalogs (understand not in the internal) to get a wider list of known archetypes when using mvn archetype:generate
.
对于没有目录的原型,用户必须键入一个必须在某处记录的可怕命令(因为它需要知道该工件)。
For archetypes without a catalog, users have to type an horrible command that must be documented somewhere (because it requires knowledge of the artifact).
关于我的主张:
-
Atlassian的原型位于内部目录中。 不是一个好主意。
Grails原型不在内部目录或已发布的原型中-catalog.xml
。 不是一个好主意。
Grails archetypes aren't in the internal catalog or in a published archetype-catalog.xml
. Not a good proposition.
此处有目录 (基于 http://servicemix.apache.org/tooling/<version>/archetype-catalog.xml
模式)。 有效提议。
ServiceMix has catalogs here http://servicemix.apache.org/tooling/ (based on a http://servicemix.apache.org/tooling/<version>/archetype-catalog.xml
pattern). Valid proposition.
一个有趣的我在挖掘这个时学到的东西。 maven人提供了一个很好的工具,可以帮助人们开发原型来创建目录XML: archetype:crawl
目标基本上抓取本地Maven存储库,搜索Archetypes并生成/更新a默认情况下, archetype-catalog.xml
文件在〜/ .m2 / repository
中。项目,人们只需定期运行如下:
One fun thing I learned while digging this. The maven guys provides a nice tool that helps people developing archetypes to create a catalog XML: the archetype:crawl
goal basically crawls a local Maven repository searching for Archetypes and generates/updates a archetype-catalog.xml
file in ~/.m2/repository
by default. Projects, people just have to run periodically something like:
mvn archetype:crawl -Dcatalog=/var/www/html/archetype-catalog.xml
Grails不提供目录。要创建项目,请:
Grails doesn't provide a catalog. To create a project, we have to run:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate -DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype \
-DarchetypeVersion=1.0 \
-DarchetypeRepository=http://snapshots.repository.codehaus.org \
-DgroupId=example -DartifactId=my-app
但是一旦我们这样做,我们在本地存储库中就有了原型。因此,如果我们输入:
But once we did this, we have the archetype in our local repository. So if we type:
mvn archetype:crawl -Dcatalog=/home/<me>/.m2/archetype-catalog.xml
原型列在〜/ .m2 / archetype-catalog中.xml
我们现在也可以为Grails使用 mvn archetype:generate
(参见选项5):
The archetype get listed in ~/.m2/archetype-catalog.xml
and we can now use the mvn archetype:generate
for Grails too (see option 5):
mvn archetype:generate
...
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: local -> maven-archetype-archetype (archetype)
2: local -> maven-archetype-j2ee-simple (j2ee)
3: local -> maven-archetype-quickstart (quickstart)
4: local -> maven-archetype-webapp (webapp)
5: local -> grails-maven-archetype (maven-project)
6: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
...
这当然是一个(丑陋的)解决方法,它可能有副作用(你不会看到新版本的原型)。实际上,我不认为原型:抓取目标是用于此用途。我希望所有项目都能发布他们的原型。
This is of course a (hugly) workaround and it might have side effects (you won't see new versions of archetypes). Actually, I don't think the archetype:crawl goal is intended for this use. I would like all projects them to publish their archetypes.
这篇关于您知道的所有Maven Archetype目录的URL是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!