Maven2 の Archetype(プロジェクトの雛形) を作ったときのメモ
> mvn archetype:generate -DgroupId=com.snail -DartifactId=WowEjbArchetype -Dversion=V00L00 -DarchetypeArtifactId=maven-archetype-archetype > cd WowEjbArchetype > mvn eclipse:eclipse
> cd WowEjbArchetype > mvn install
> mvn archetype:generate -DarchetypeGroupId=com.snail -DarchetypeArtifactId=WowEjbArchetype -DarchetypeVersion=V00L00 -DgroupId=com.snail -DartifactId=myapp-ejb -Dversion=0.1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.snail</groupId> <artifactId>WowEjbArchetype</artifactId> <version>V00L00</version> <name>Archetype - WowEjbArchetype</name> <url>http://maven.apache.org</url> <packaging>maven-plugin</packaging> </project>
<?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion> <groupId>${groupId}</groupId> <artifactId>${artifactId}</artifactId> <version>${version}</version> <packaging>ejb</packaging> ... </project>
<archetype> <id>WowEjbArchetype</id> <sources> <source>src/main/java/App.java</source> </sources> <resources> <resource>src/main/resources/App.properties</resource> </resources> <testSources> <source>src/test/java/AppTest.java</source> </testSources> <testResources> <resource>src/test/resources/App.properties</resource> </testResources> </archetype>
$ mvn archetype:create-from-project
#set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' )テンプレート中では
${symbol_pound} ${symbol_dollar} ${symbol_escape}とする
${groupId} ${artifactId} ${version} ${package}
${artifactId.replaceAll("-", "_")}
#set($appName = $artifactId.replaceAll("-", "_"))