您所知道的所有 Maven Archetype 目录的 URL 是什么?
Maven Archetypes 是“模板”,您可以通过它快速生成正在运行的示例给定框架或项目类型。 我正在尝试编译当前在网络上活跃的所有 Maven 原型目录的列表。
存储有关原型的知识 在目录中。
目录是 xml 文件。
Archetype 插件捆绑在一起 带有内部目录。 这个是 默认使用。
Archetype 插件可以使用目录 来自本地文件系统和 HTTP 连接。
到目前为止,我已经收集了发布目录的存储库列表,但很想看看是否有人知道更多信息:
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) FuseSource 2) 茧 3) Java.net 4) MyFaces 5) 挂毯 6) Scala 目录 7) Terracotta Catalog
你会注意到,如果存储库实际上发布原型目录(上述所有操作),您将收到一个 UI 提示,显示在该 archetype-catalog.xml
中找到的所有选项。 例如:
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目录文件,你可以浏览到http:// /scala-tools.org/archetype-catalog.xml
但是如果存储库不提供 archetype-catalog.xml,那么就像 PascalT 所说的那样,您需要提前知道名称(更不用说方便)并将其传递到命令行参数中。
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.
From the Maven documentation about catalog files:
Knowledge about archetypes are stored
in catalogs.The catalogs are xml files.
The Archetype Plugin comes bundled
with an internal catalog. This one is
used by default.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/
Links to same:
1) FuseSource
2) Cocoon
3) Java.net
4) MyFaces
5) Tapestry
6) Scala Catalog
7) Terracotta Catalog
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):
If you want to view the Scala catalog file directly for example, you can browse to http://scala-tools.org/archetype-catalog.xml
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
说实话,我真的不明白建立所有目录的列表有什么意义。 对我来说,首先选择一个项目然后根据需要添加目录看起来更“自然”。 这就是为什么在我看来原型列表更有价值。 无论如何,即使您在列表中拥有所有目录,您仍然需要他们的名字。无论如何,这里有一些候选者;
Atlassian 在 https://maven.atlassian.com/repository/public/编辑:在 Matthew 对原型目录进行澄清之后。
我误解了一些概念,我的答案不清楚也不正确。
目录的目的正是不必提前知道原型的名称。 它们用于发布原型并允许 mvn archetype:generate 列出原型。 因此,在使用 mvn archetype:generate 时添加“外部”目录(理解不是内部的)以获得更广泛的已知原型列表是有意义的。
对于没有目录的原型,用户必须输入一个可怕的命令,该命令必须记录在某处(因为它需要工件的知识)。
关于我的建议:
Atlassian 的原型位于内部目录中。 这不是一个好建议。
Grails 原型不在内部目录中,也不在已发布的
archetype-catalog.xml
中。 这不是一个好建议。ServiceMix 这里有目录http://servicemix.apache.org/tooling/ (基于
http://servicemix.apache. org/tooling//archetype-catalog.xml
模式)。 有效的建议。我在挖掘这个问题时学到了一件有趣的事情。 Maven 人员提供了一个很好的工具,可以帮助人们开发原型来创建目录 XML:
archetype:crawl
目标基本上是爬取本地 Maven 存储库,搜索原型并生成/更新archetype-catalog默认情况下,.xml
文件位于~/.m2/repository
中。 人们只需要定期运行项目,例如:Grails 不提供目录。 要创建一个项目,我们必须运行:
但是一旦我们这样做了,我们就有了原型我们的本地存储库。 因此,如果我们输入:
原型会列在
~/.m2/archetype-catalog.xml
中,我们现在也可以使用 Grails 的mvn archetype:generate
(请参阅选项5):这当然是一个(巨大的)解决方法,它可能会产生副作用(您不会看到新版本的原型)。 实际上,我不认为 archetype:crawl 目标是用于此用途的。 我希望所有项目都发布他们的原型。
To be honest, I don't really see the point of building a list of all catalogs. It looks more "natural" to me to pick a project first and then add the catalog if required. This is why there is IMO more value in a list of archetypes. You'll need their name anyway, even if you have all catalogs in a list.Anyway, here are some candidates;
Atlassian has archetypes in https://maven.atlassian.com/repository/public/Edit: after Matthew clarification on archetype's catalogs.
I misunderstood some concepts and my answer isn't clear and correct.
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 usingmvn 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).
Regarding my propositions:
Atlassian's archetypes are in the internal catalog. Not a good proposition.
Grails archetypes aren't in the internal catalog or in a published
archetype-catalog.xml
. Not a good proposition.ServiceMix has catalogs here http://servicemix.apache.org/tooling/ (based on a
http://servicemix.apache.org/tooling/<version>/archetype-catalog.xml
pattern). Valid proposition.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 aarchetype-catalog.xml
file in~/.m2/repository
by default. Projects, people just have to run periodically something like:Grails doesn't provide a catalog. To create a project, we have to run:
But once we did this, we have the archetype in our local repository. So if we type:
The archetype get listed in
~/.m2/archetype-catalog.xml
and we can now use themvn archetype:generate
for Grails too (see option 5):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.
Terracotta 有一个,但我一时不知道网址...将回发。 另外,我过去曾使用过 AppFuse (http://static.appfuse.org/releases/) 和 Webtide 虽然我不知道在哪里可以找到他们的原型目录。
Terracotta 存储库和目录位于:http://www.terracotta.org/download/reflector /maven2/
也许这很有用:
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
Terracotta has one but I don't know the url off-hand...will post back. Also, I have used archetypes in the past from AppFuse (http://static.appfuse.org/releases/) and Webtide although I don't know where to find their archetype catalogs.
The Terracotta repository and catalog are here: http://www.terracotta.org/download/reflector/maven2/
Perhaps this is useful:
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
由 Nexus 生成并由 M2eclipse 使用的 Nexus 索引了解所有原型,并允许您在从 ide 创建新的 Maven 项目时选择它们。
The nexus index that is produced by Nexus and consumed by M2eclipse knows about all the archetypes and lets you choose them when you create a new maven project from the ide.
对于 Maven Archetype 列表,请参阅此链接 http://www.myjeeva.com /2012/06/exclusive-maven-archetype-list/(你会发现大约 607 个原型)。
在使用
mvn archetype:generate
命令时,选择一个数字或应用过滤器(格式:[groupId:]artifactId,区分大小写):197:
提供来自上面链接的原型编号。
注意:默认值为 197
For Maven Archetype list refer this link http://www.myjeeva.com/2012/06/exclusive-maven-archetype-list/ (you will find around 607 Archetypes).
While using
mvn archetype:generate
command at question ofChoose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 197:
provide archetype number from above link.
Note: default value is 197
Codehaus 还有另一个资源,提供了网络上非常强大的原型列表。
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
There's yet another resource at Codehaus for a very robust list of archetypes out there on the 'net.
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List