---
title: "Maven编写archeType小问题"
author: "xly1981"
date: "2018-04-07T17:17:16Z"
tags: ["maven"]
categories: ["企业架构"]
slug: "maven-archetype"
draft: false
lastmod: "2018-04-07T17:17:16Z"
id: 2415880
url: "https://xly1981.iteye.com/blog/2415880"
---


异常1：
ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates: Unable to find resource 'archetype-resources/pom.xml'

原因：
src/resources/archetype-resources 错写成archetype-resource ;mvn install可以编译通过；
但是在使用这个archetype构造的时候会报错;没有找到资源...


异常2：
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: Archetype com.xly:xly-archetype:1.0-SNAPSHOT is not configured
[ERROR] Property port is missing.

原因：
mvnBook的github代码在archetype-metadata.xml文件里面，对requiredProperties->requiredProperty> 里面的port属性没有配置defaultValue ;在对archetype做install没有问题，但是在用自己的archetype构建自己的项目;会抛出Property port is missing，但因为是第二个Error，容易被忽略