On Wed, 2005-10-26 at 18:24 +0200, Alexander Hars wrote:
> Hi,
> thank you for all the helpful tips about where to look for creating 
> archetypes. I am summarizing what I learned in a step-by-step guide below:
> 
> The only question that I have not been able to solve is how to use 
> instruct an archetype to create an EMPTY directory (<directory> tag does 
> not work).

If you can integrate it into this:

http://maven.apache.org/guides/mini/guide-creating-archetypes.html

In APT format I would apply the patch immediately. It's hard to
integrate non-standard formats. I greatly appreciate the effort but
doing the doco in our current standard format APT pretty much guarantees
the patch will be applied.

Here's the format of the archetype guide:

http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-
site/src/site/apt/guides/mini/guide-creating-archetypes.apt?
rev=326378&view=markup

And here's the guide for APT:

http://maven.apache.org/guides/mini/guide-apt-format.html

Again, not to discourage you but it's just hard at the moment with
everything going on to absorb non APT doco submissions.

> --------------------------------------------------------------------------------------------------------
>                  H O W     T O     C R E A T E      A  N      A R C H E 
> T Y P E
> --------------------------------------------------------------------------------------------------------
> 
> 1. Create a new project.
>  add the directories:
>     src/main/resources/META-INF              //will hold archetype.xml
>     src/main/resources/archetype-resources   //will hold the pom.xml and 
> source tree that need to be copied
> 
> 2. Create a POM for the archetype, e.g.
> 
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>my.groupId<groupId>
>   <artifactId>my-archetype-id</artifactId>
>   <version>1.0-SNAPSHOT</version>
>   <packaging>maven-plugin</packaging>
> </project>
> 
> 3. The file structure for your archetype must be located in the
> directory: src/main/resources/META-INF and 
> src/main/resources/archetype-resources
> 
> 4. create an archetype descriptor in a file called archetype.xml and 
> place it in:
> src/main/resources/META-INF/pom.xml
> Note that <allowPartial>true</allowPartial> makes it possible to run the 
> archetype creation on an existing project.
> 
> for example:
> 
> <archetype>
>   <id>my-archetype-id</id>
>   <allowPartial>false</allowPartial>
>   <sources>
>      <source>src/main/java/App.java</source>
>   </sources>
>   <testSources>
>     <source>src/test/java/AppTest.java</source>
>   </testSources>
>   <siteResources>
>     <resource>src/site/apt/index.apt</resource>
>   </siteResources>
> </archetype>
> 
> You can select from the following tags:
>  <sources> = src/main/java
>  <resources> = src/main/resources
>  <test-sources> = src/test/java
>  <test-resources> = src/test/resources
>  <site-resources> = src/site
> 
> (I have not been able to find a way to create empty directories, though).
> 
> 5. create the pom.xml that the archetype should create and place it
> in:
> src/main/resources/archetype-resources/pom.xml
> 
> for example:
> <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>${groupId}</groupId>
>   <artifactId>${artifactId}</artifactId>
>   <packaging>jar</packaging>
>   <version>${version}</version>
>   <name>A custom project</name>
>   <url>http://www.myorganization.org</url>
>   <dependencies>
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>3.8.1</version>
>       <scope>test</scope>
>     </dependency>
>   </dependencies>
> </project>
> 
> 6. run mvn install
> This installs your archetype locally.
> 
> 7. to create a new project based on your archetype use:
>  mvn archetype:create -DarchetypeGroupId=my.groupId 
> -DarchetypeArtifactId=my-archetype-id -DarchetypeVersion=1.0-SNAPSHOT 
> -DgroupId=my.organization -DartifactId=myArtifactId
> Note: Don't forget -DarchetypeVersion !
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

Our achievements speak for themselves. What we have to keep track
of are our failures, discouragements and doubts. We tend to forget
the past difficulties, the many false starts, and the painful
groping. We see our past achievements as the end result of a
clean forward thrust, and our present difficulties as
signs of decline and decay.

 -- Eric Hoffer, Reflections on the Human Condition


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to