I think this has come up before and we wanted to avoid doing it for things on 
the command line, where it is hard to override. In general that would be true, 
but for the archetype plugin being the first experience people have with Maven, 
a bit more reliability would probably be useful.

I thought we could apply the patch below in 2.2.2. This would by default lock 
it down, but allow the comparatively simple cmd line to get a different version:

$ mvn archetype:generate -Dmaven.archetype.version=2.0-alpha-6-SNAPSHOT

Or the corresponding change permanently in settings.xml:

<profile>
  <id>properties</id>
  <properties>
    <maven.archetype.version>2.0-alpha-6-SNAPSHOT</maven.archetype.version>
  </properties>
</profile>
...
<activeProfiles>
  <activeProfile>properties</activeProfile>
</activeProfiles>

The downside is that at the moment this works for settings the version 
correctly when a pom.xml exists, but not when one doesn't (which I think might 
be a bug in 2.2.2 that would also need fixing). I haven't checked trunk but it 
might work there already. Perhaps we might only do it for 3.0 if that's the 
case (esp. since this has a very minor chance of incompatibility if the 
property is in use).

I wouldn't want to do this for every plugin - having magic properties is 
something to be wary of - but this one might be worthwhile as a special case?

Thoughts?

- Brett


Index: maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
===================================================================
--- maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml     
(revision 899508)
+++ maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml     
(working copy)
@@ -68,9 +68,13 @@
         <directory>${project.basedir}/src/test/resources</directory>
       </testResource>
     </testResources>
-   <pluginManagement>
-       <plugins>
+    <pluginManagement>
+      <plugins>
          <plugin>
+           <artifactId>maven-archetype-plugin</artifactId>
+           <version>${maven.archetype.version}</version>
+         </plugin>       
+         <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.3</version>
          </plugin>       
@@ -204,6 +208,8 @@
       </build>
     </profile>
   </profiles>
-
+  <properties>
+    <maven.archetype.version>2.0-alpha-4</maven.archetype.version>
+  </properties>
 </project>

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to