Hi Jason,

thanks very much for the helpful response. However, I have already been looking at the quickstart guide. If I run the following sequence of commands, copied directly from this guide:

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-site

...then I still get the "please run from a clean directory" error. Because this happens before it attempts to download the "maven-archetype-site" artefact, it suggests to me that the artefact plugin isn't checking any settings in the archetype before throwing this error. When I check my repository, I am using archetype plugin "maven-archetype-1.0-alpha-3".

Should I expect this to work with the 1.0-alpha-3 archetype plugin, or is this such a new feature that it hasn't made it into a release yet?

Another thing that I'm curious about - when it is doing a partial create of an archetype that contains a new POM (as the site archetype does), is it clever about merging the new POM with the old. For example, will it merge the dependencies in the archetype POM with those already in the target project?

Thanks again,

Alex.

Jason van Zyl wrote:

On Sun, 2005-10-30 at 12:27 +0000, Alex McManus wrote:
I'm just getting to grips with Maven for the first time, and having some difficulties getting archetypes to add files to an existing project. If I understand things correctly, archetypes can also be used to add files to an existing project, as well as to create a new one from scratch. This is controlled via the <allowPartial> element in the archetype.xml file.

Correct.

First question: why do none of the core archetypes support partial behaviour?

It is a new feature that was added specifically for the getting started
guide so that a site can be added to an existing project. I also wanted
to be able to build up large projects but the site archetype was the
first stage. Just a matter of resources and time to adjust or add new
archetypes that can be additive.
It seems to make sense that I can use the quickstart archetype to setup my initial project, then add web capabilities with the webapp archetype, and then add site documentation with the site archetype.

Absolutely.

Each of these archetypes creates discrete directories under src that would seem to be able to co-exist with each other.

There are definitely cases where you don't want an archetype to be
partial but the site archetype and archetypes that might be used to
build up a j2ee app would are good examples of useful partial
archetypes.

Second question: does anyone have the allowPartial behaviour working in an archetype (and are there any examples that I can look at)? I've tried to setup some simple examples, but I always get the some error as above.

You can use the quickstart archetype with the site archetype. The site
archetype is currently the only partial archetype. You can look at the
getting started guide where it's described:

http://maven.apache.org/guides/getting-started/index.html

My apologies if I'm missing something blindingly obvious, any help would be appreciated...

It's just that the archetypes haven't been adjusted yet.

Reply via email to