【发布时间】:2018-03-17 15:17:06
【问题描述】:
我正在尝试使用我自己的项目模板,但是当我执行命令时:
mvn archetype:generate -DarchetypeCatalog=local
我收到以下消息:
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.
archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
Your filter doesn't match any archetype (hint: enter to return to initial list)
Choose a number or apply filter (format: [groupId:]artifactId, case-sensitive contains): :
我尝试了许多我在这里找到的可能的解决方案,但我没有成功......
我的步骤:
- 我在eclipse中创建了一个项目
- 然后我进入这个项目的根目录并在提示符下执行以下命令:
mvn archetype:create-from-project
并取得了成功。
然后我对项目的文件夹执行了以下命令
mvn install
并取得了成功
我检查了 .m2 文件夹,archetpe-catalog.xml 在那里:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<archetypes>
<archetype>
<groupId>io.openbdt</groupId>
<artifactId>framework-openbdt</artifactId>
<version>1.0</version>
<description>framework-openbdt</description>
</archetype>
</archetypes>
</archetype-catalog>
在 maven 的文档中解释说 archetypeCatalog=local 的默认路径是 path/.m2/archetype-catalog.xml 但在调试中(mvn archetype:generate -DarchetypeCatalog= local -X),maven在path/.m2/repository/archetype-catalog.xml
中搜索xml文件注意:这些步骤通常在我的笔记本中执行,但在我的桌面上我没有成功。然后我在笔记本上创建了一个新用户,它也不再工作了。
有人可以帮帮我吗?
【问题讨论】:
-
有时 maven 在 Eclipse 上不能正常工作,你应该在构建项目之前构建 maven
-
有一个命令但我不记得了,ctr alt f5 之类的,否则试试 mvn build
标签: java xml maven archetypes xmlcatalog