maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherit...@apache.org
Subject svn commit: r405247 - in /maven/maven-1/plugins/trunk/ant: ./ plugin.jelly plugin.properties project.xml xdocs/changes.xml xdocs/properties.xml
Date Tue, 09 May 2006 00:50:01 GMT
Author: aheritier
Date: Mon May  8 17:50:00 2006
New Revision: 405247

URL: http://svn.apache.org/viewcvs?rev=405247&view=rev
Log:
MPANT-19 : The plugin overwrote existing ant script files without warning. From now the plugin
ask you if you want to replace it. You can also use the property maven.ant.generate.force
to force the plugin to replace the current script.

Modified:
    maven/maven-1/plugins/trunk/ant/   (props changed)
    maven/maven-1/plugins/trunk/ant/plugin.jelly
    maven/maven-1/plugins/trunk/ant/plugin.properties
    maven/maven-1/plugins/trunk/ant/project.xml
    maven/maven-1/plugins/trunk/ant/xdocs/changes.xml
    maven/maven-1/plugins/trunk/ant/xdocs/properties.xml

Propchange: maven/maven-1/plugins/trunk/ant/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon May  8 17:50:00 2006
@@ -9,3 +9,4 @@
 *.ipr
 *.iws
 project.xml.backup
+build.xml

Modified: maven/maven-1/plugins/trunk/ant/plugin.jelly
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ant/plugin.jelly?rev=405247&r1=405246&r2=405247&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ant/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/ant/plugin.jelly Mon May  8 17:50:00 2006
@@ -22,7 +22,9 @@
   xmlns:ant="jelly:ant"
   xmlns:maven="jelly:maven"
   xmlns:test="test"
-  xmlns:j="jelly:core">
+  xmlns:j="jelly:core"
+  xmlns:i="jelly:interaction"
+  xmlns:u="jelly:util">
   <!-- ================================================================== -->
   <!-- A N T  B U I L D  G E N E R A T O R                                -->
   <!-- ================================================================== -->
@@ -37,21 +39,52 @@
            description="Generate an Ant build file"
            prereqs="ant:generate-build"/>
 
+  <goal name="ant:generate-build"
+           description="Generate an Ant build file"
+           prereqs="ant:verify-script-exists,ant:generate-script"/>
+
+  <goal name="ant:verify-script-exists" description="Check if the script already exists.">
+    <u:file var="projectAsFile" name="${maven.ant.generate.dir}/${maven.ant.generate.script}"/>
+    <j:if test="${(projectAsFile.exists())}">
+      <ant:echo>The ant script [${maven.ant.generate.dir}/${maven.ant.generate.script}]
already exists !!</ant:echo>
+      <j:choose>
+        <j:when test="${(maven.ant.generate.force == null) or not (maven.ant.generate.force
== 'true')}">
+          <i:ask question="Would you like to override your current script (y/n)?" answer="ok"
default="y"/>
+          <j:choose>
+            <j:when test="${ok == 'y'}">
+              <ant:echo>!! Your script will be replaced replaced !!</ant:echo>
+            </j:when>
+            <j:otherwise>
+              <ant:echo>Script generation aborted.</ant:echo>
+              <j:set var="abortProcess" value="true"/>
+            </j:otherwise>        
+          </j:choose>
+        </j:when>      
+        <j:otherwise>
+          <ant:echo>The property "maven.ant.generate.force" is setted to [${maven.ant.generate.force}].</ant:echo>
+          <ant:echo>!! Your current script will be replaced !!</ant:echo>
+        </j:otherwise>
+      </j:choose>
+    </j:if>
+  </goal>
+
   <goal
-    name="ant:generate-build"
+    name="ant:generate-script"
     description="Generate an Ant build file">
-    <j:if test="${context.getVariable('maven.ant.generatebuild.file') != null and !context.getVariable('maven.ant.generatebuild.file').equals('')}">
-      <ant:echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</ant:echo>
-      <ant:echo>The property "maven.ant.generatebuild.file" is no more used.</ant:echo>
-      <ant:echo>Use the properties "maven.ant.generate.dir" and "maven.ant.generate.script"
instead</ant:echo>
-      <ant:echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</ant:echo>
+    <j:if test="${context.getVariable('abortProcess') == null or context.getVariable('abortProcess')
!= true}">
+      <j:if test="${context.getVariable('maven.ant.generatebuild.file') != null and !context.getVariable('maven.ant.generatebuild.file').equals('')}">
+        <ant:echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</ant:echo>
+        <ant:echo>The property "maven.ant.generatebuild.file" is no more used.</ant:echo>
+        <ant:echo>Use the properties "maven.ant.generate.dir" and "maven.ant.generate.script"
instead</ant:echo>
+        <ant:echo>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</ant:echo>
+      </j:if>
+      <ant:echo>Generating ${maven.ant.generate.dir}/${maven.ant.generate.script} ...</ant:echo>
+      <ant:mkdir dir="${maven.ant.generate.dir}"/>
+      <j:file name="${maven.ant.generate.dir}/${maven.ant.generate.script}" prettyPrint="true">
+        <j:import file="${plugin.resources}/templates/build.jelly" inherit="true"/>
+      </j:file>
+      <ant:echo>${maven.ant.generate.dir}/${maven.ant.generate.script} generated.</ant:echo>
     </j:if>
-    <ant:echo>Generating ${maven.ant.generate.dir}/${maven.ant.generate.script} ...</ant:echo>
-    <ant:mkdir dir="${maven.ant.generate.dir}"/>
-    <j:file name="${maven.ant.generate.dir}/${maven.ant.generate.script}" prettyPrint="true">
-      <j:import file="${plugin.resources}/templates/build.jelly" inherit="true"/>
-    </j:file>
-    <ant:echo>${maven.ant.generate.dir}/${maven.ant.generate.script} generated.</ant:echo>
   </goal>
   
   <goal

Modified: maven/maven-1/plugins/trunk/ant/plugin.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ant/plugin.properties?rev=405247&r1=405246&r2=405247&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ant/plugin.properties (original)
+++ maven/maven-1/plugins/trunk/ant/plugin.properties Mon May  8 17:50:00 2006
@@ -23,6 +23,7 @@
 
 maven.ant.generate.script = build.xml
 maven.ant.generate.dir    = ${basedir}
+maven.ant.generate.force  = false
 
 maven.ant.execute.script = ${maven.ant.generate.script}
 maven.ant.execute.dir    = ${maven.ant.generate.dir}

Modified: maven/maven-1/plugins/trunk/ant/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ant/project.xml?rev=405247&r1=405246&r2=405247&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ant/project.xml (original)
+++ maven/maven-1/plugins/trunk/ant/project.xml Mon May  8 17:50:00 2006
@@ -90,6 +90,11 @@
         <comment>This library is already loaded by maven's core. Be careful to use
the same version number as in the core.</comment>
       </properties>
     </dependency>
+    <dependency>
+      <groupId>commons-jelly</groupId>
+      <artifactId>commons-jelly-tags-interaction</artifactId>
+      <version>1.0</version>
+    </dependency>
   </dependencies>
  <reports>
     <report>maven-changes-plugin</report>

Modified: maven/maven-1/plugins/trunk/ant/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ant/xdocs/changes.xml?rev=405247&r1=405246&r2=405247&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ant/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/ant/xdocs/changes.xml Mon May  8 17:50:00 2006
@@ -26,6 +26,7 @@
   </properties>
   <body>
     <release version="1.10-SNAPSHOT" date="In SVN">
+      <action dev="aheritier" type="add" issue="MPANT-19">The plugin overwrote existing
ant script files without warning. From now the plugin ask you if you want to replace it. You
can also use the property maven.ant.generate.force to force the plugin to replace the current
script.</action>
       <action dev="aheritier" type="update">The property maven.ant.generatebuild.file
is replaced by properties maven.ant.generate.dir, maven.ant.generate.script. The generated
script is ${maven.ant.generate.dir}/${maven.ant.generate.script}.</action>
       <action dev="aheritier" type="del">The property maven.ant.generatebuild.file
is removed.</action>
       <action dev="aheritier" type="add" issue="MPANT-25">Add a new goal (ant:execute)
to execute a build.xml file from maven.</action>

Modified: maven/maven-1/plugins/trunk/ant/xdocs/properties.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/ant/xdocs/properties.xml?rev=405247&r1=405246&r2=405247&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/ant/xdocs/properties.xml (original)
+++ maven/maven-1/plugins/trunk/ant/xdocs/properties.xml Mon May  8 17:50:00 2006
@@ -48,6 +48,13 @@
           <td>${basedir}</td>
         </tr>
         <tr>
+          <td>maven.ant.generate.force</td>
+          <td>If the ant script file already exists the plugin ask you if you want
to replace it. Setting this property to true, will force the plugin to overwrite this file
without to ask the question.</td>
+          <td>since 1.10</td>
+          <td>Yes</td>
+          <td>false</td>
+        </tr>
+        <tr>
           <td>maven.ant.excludeTests</td>
           <td>Holds a comma separated list of source file patterns that will be excluded
in the generated Ant build, e.g.</td>
           <td>since 1.2</td>



Mime
View raw message