dion        2002/06/02 20:44:56

  Modified:    src/templates/build build.init.target
               src/templates/build/plugins/j2ee build.xml Control.vm
               .        project.xml project.properties build-bootstrap.xml
               src/templates/build/plugins/core default.properties
                        Control.vm
               src/java/org/apache/maven/ant GetList.java
               src/java/org/apache/maven UpdatePomCheck.java
  Added:       src/templates/build/plugins/core build-init.xml
  Log:
  - Remove the need for bootstrap for j2ee plugin
  - Add build-init.xml to hold common init processing across build files
  - Use maven:ant to allow properties to be passed back and forth between
    build files
  - This will eventually allow plugins to be installed rather than needing to
    be compiled in
  - Fixed several property problems with to/fromVersion processing and update
    checks in build-init-target.
  
  Revision  Changes    Path
  1.37      +9 -8      jakarta-turbine-maven/src/templates/build/build.init.target
  
  Index: build.init.target
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build.init.target,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- build.init.target 25 May 2002 13:29:10 -0000      1.36
  +++ build.init.target 3 Jun 2002 03:44:55 -0000       1.37
  @@ -72,7 +72,7 @@
   
     <target 
       name="verify-project-noproxy" 
  -    unless="proxy.host" 
  +    unless="maven.proxy.host" 
       depends="prepare.httpget">
       
       <verify-project
  @@ -105,7 +105,7 @@
      
     <target
       name="project-properties"
  -    unless="pomLoaded">
  +    unless="maven.pomLoaded">
   
       <taskdef
         name="project-properties"
  @@ -156,7 +156,7 @@
   
     <target
       name="update-pom-check"
  -    unless="pomChecked">
  +    unless="maven.pomChecked">
       
       <taskdef
         name="update-pom-check"
  @@ -165,7 +165,7 @@
       </taskdef>
       
       <!-- This task will place a property into the build called
  -         'pomUpdateRequired' if the version of the POM is out of
  +         'maven.pomUpdateRequired' if the version of the POM is out of
            sync with what Maven expects.
       -->
       
  @@ -179,7 +179,7 @@
   
     <target
       name="callUpdateDescriptor"
  -    if="pomUpdateRequired">
  +    if="maven.pomUpdateRequired">
       
       <antcall target="update-descriptor"/>
   
  @@ -287,7 +287,8 @@
       | N O T I C E 
       +------------------------------------------------------------------------------
       |
  -    | Updating project descriptor from version ${fromVersion} to version 
${toVersion}
  +    | Updating project descriptor from version ${maven.fromVersion} 
  +    |   to version ${maven.toVersion}
       |
       +------------------------------------------------------------------------------
       </echo>
  @@ -320,12 +321,12 @@
       <!-- Give our new project descriptor its proper name -->
       <copy 
         tofile="project.xml" 
  -      file="project.xml.${toVersion}"
  +      file="project.xml.${maven.toVersion}"
         overwrite="true"
       />
       
       <!-- Get rid of the temporary copy -->    
  -    <delete file="project.xml.${toVersion}"/>
  +    <delete file="project.xml.${maven.toVersion}"/>
       
     </target>
   
  
  
  
  1.8       +101 -8    jakarta-turbine-maven/src/templates/build/plugins/j2ee/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/j2ee/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml 31 May 2002 15:11:09 -0000      1.7
  +++ build.xml 3 Jun 2002 03:44:55 -0000       1.8
  @@ -1,16 +1,38 @@
   <?xml version='1.0' encoding='UTF-8' ?>
   
  -<project name="$project.id" default="war" basedir="$antBasedir">
  -
  -#parse("build.init.target")
  +<project name="maven" default="war" basedir="$antBasedir">
   
     <!-- ================================================================== -->
  +  <!-- I N I T                                                            -->
  +  <!-- ================================================================== -->
  +  <target name="init">
  +    <!-- Pick up tool default properties for maven.jars.list -->
  +    <property file="${maven.home}/plugins/core/default.properties"/>
  +
  +    <!-- define maven classpath for the build -->
  +    <path id="maven-classpath">
  +      <fileset dir="${lib.repo}" includes="${maven.jars.list}" />
  +    </path>
  +    
  +    <!-- define maven taskdefs, as taskdefs are not yet inheritable -->
  +    <taskdef resource="maven-taskdefs.properties">
  +      <classpath refid="maven-classpath" />
  +    </taskdef>
  +    
  +    <!-- call common build file initialization to verify project, update jars
  +         etc -->
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="verify-project" inheritAll="true" inheritRefs="true" 
  +      exportAll="true"/>
  +  </target>
  +  
  +  <!-- ================================================================== -->
     <!-- L O C A L   I N I T                                                -->
     <!-- ================================================================== -->
   
     <target name="local-init" depends="init">
       <!-- Pick up tool specific defaults -->
  -    <property file="${maven.home}/plugins/$plugin/default.properties"/>
  +    <property file="${maven.home}/plugins/j2ee/default.properties"/>
           
       <!-- Check all requirements are available -->
       <condition property="maven.j2ee.war.ready">
  @@ -47,7 +69,7 @@
     </target>
     
     <target name="war" depends="local-init,war-error,war-init,
  -    #callback("pre-war"), war-build, #callback("post-war")"
  +    pre-war-callback, war-build, post-war-callback"
       description="o Create a war file" />
    
     <target name="war-error" unless="maven.j2ee.war.ready">
  @@ -77,6 +99,18 @@
       <!-- nothing to do as of yet -->
     </target>    
       
  +  <target name="pre-war-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.pre-war.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.pre-war.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.pre-war.buildFile" />
  +    </maven-ant>
  +  </target>
  +  
     <target name="war-build" if="maven.j2ee.war.ready">
       <!-- make sure the source is compiled -->
       <ant antfile="${maven.home}/plugins/core/build.xml" target="jar" />
  @@ -115,6 +149,18 @@
         </manifest>
       </war>
     </target>
  +  
  +  <target name="post-war-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.post-war.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.post-war.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.post-war.buildFile" />
  +    </maven-ant>
  +  </target>
   
     <target name="validate-war" depends="local-init">
       <taskdef name="warvalidator" classname="org.apache.maven.j2ee.WarValidator">
  @@ -132,7 +178,7 @@
           EAR processing 
     -->
     <target name="ear" depends="local-init,ear-error,war,ear-init,
  -    #callback("pre-ear"),ear-build,#callback("post-ear")"
  +    pre-ear-callback,ear-build,post-ear-callback"
       description="o Create an ear file" />
   
     <target name="ear-error" unless="maven.j2ee.ear.ready">
  @@ -157,6 +203,18 @@
       <!-- nothing to do as of yet -->
     </target>
   
  +  <target name="pre-ear-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.pre-ear.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.pre-ear.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.pre-ear.buildFile" />
  +    </maven-ant>
  +  </target>
  +
     <target name="ear-build" if="maven.j2ee.ear.ready">
       <echo>Building EAR ${maven.j2ee.ear.name}</echo>
           
  @@ -186,12 +244,23 @@
       </ear>
     </target>
       
  +  <target name="post-ear-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.post-ear.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.post-ear.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.post-ear.buildFile" />
  +    </maven-ant>
  +  </target>
   
     <!-- 
           ejb processing 
     -->
  -  <target name="ejb" depends="local-init,ejb-error,ejb-init,
  -    #callback("pre-ejb"),ejb-build,#callback("post-ejb")"
  +  <target name="ejb" depends="local-init,ejb-error,ejb-init,pre-ejb-callback,
  +    ejb-build,post-ejb-callback"
       description="Create an ejb file" />
   
     <target name="ejb-error" unless="maven.j2ee.ejb.ready">
  @@ -219,6 +288,18 @@
         value="${maven.build.dir}/ejb/"/>
     </target>
   
  +  <target name="pre-ejb-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.pre-ejb.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.pre-ejb.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.pre-ejb.buildFile" />
  +    </maven-ant>
  +  </target>
  +
     <target name="ejb-build" depends="ejb-jar, ejb-remote, ejb-local" 
       if="maven.j2ee.ejb.ready"/>
   
  @@ -340,6 +421,18 @@
           </section>
         </manifest>
       </jar>
  +  </target>
  +
  +  <target name="post-ejb-callback">
  +    <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
  +      target="callback" inheritAll="true" inheritRefs="true">
  +      <property name="buildFile" 
  +        value="${maven.j2ee.callback.post-ejb.buildFile}" />
  +      <property name="buildTarget" 
  +        value="${maven.j2ee.callback.post-ejb.buildTarget}" />
  +      <property name="buildTargetName" 
  +        value="maven.j2ee.callback.post-ejb.buildFile" />
  +    </maven-ant>
     </target>
       
   </project>
  
  
  
  1.5       +9 -6      
jakarta-turbine-maven/src/templates/build/plugins/j2ee/Control.vm
  
  Index: Control.vm
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/j2ee/Control.vm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Control.vm        23 May 2002 09:02:24 -0000      1.4
  +++ Control.vm        3 Jun 2002 03:44:55 -0000       1.5
  @@ -1,3 +1,11 @@
  +##
  +## author:  dion
  +## version: $Id: Control.vm,v 1.5 2002/06/03 03:44:55 dion Exp $
  +##
  +## Long term we need to remove this file. It provides:
  +##      1) a list of files for the bootstrap to copy (installation of plugin)
  +##      2) targets for the delegator (part of install, or done in a maven script)
  +##
   ## -------------------------------------------------------
   ## Control file for Maven j2ee plug-in
   ## -------------------------------------------------------
  @@ -14,9 +22,4 @@
   $delegators.put("war",          "plugins/$plugin/build.xml")
   $delegators.put("validate-war", "plugins/$plugin/build.xml")
   $delegators.put("ejb",          "plugins/$plugin/build.xml")
  -$delegators.put("ear",          "plugins/$plugin/build.xml")
  -
  -## -------------------------------------------------------
  -## Make the list of build-j2ee.xml callbacks
  -## -------------------------------------------------------
  -$callbacks.put( "$plugin", [ "pre-war", "post-war", "pre-ejb", "post-ejb", 
"pre-validate-war", "post-validate-war", "pre-ear",  "post-ear" ] )
  +$delegators.put("ear",          "plugins/$plugin/build.xml")
  \ No newline at end of file
  
  
  
  1.92      +1 -0      jakarta-turbine-maven/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- project.xml       1 Jun 2002 23:31:38 -0000       1.91
  +++ project.xml       3 Jun 2002 03:44:55 -0000       1.92
  @@ -388,6 +388,7 @@
       <jarResources>
           <jarResource>include = *.dtd</jarResource>
           <jarResource>include = log4j.properties</jarResource>
  +        <jarResource>include = maven-taskdefs.properties</jarResource>
       </jarResources>
   
       <jars>
  
  
  
  1.15      +13 -0     jakarta-turbine-maven/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/project.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- project.properties        28 May 2002 16:44:33 -0000      1.14
  +++ project.properties        3 Jun 2002 03:44:55 -0000       1.15
  @@ -17,3 +17,16 @@
   maven.announcement = beta2
   
   maven.checkstyle.excludes = org/apache/maven/java/parser/**
  +
  +# jars needed in lib.repo by maven to execute
  +# This is a DUPLICATE of the entry in ${maven.home}/plugins/core/default.properties
  +# as that file is not guaranteed to be available during bootstrapping.
  +# TODO: It may be possible to change the bootstrap process to use the 
  +# src/templates/build/plugins/core/defaults.properties
  +maven.jars.list=antlr-2.7.1.jar,bcel-5.0.jar,checkstyle-2.2.jar,\
  +commons-beanutils-dev.jar,commons-betwixt-1.0-dev.jar,\
  +commons-collections-2.0.jar,commons-digester-1.2.jar,commons-graph-0.8.jar,\
  +commons-io-0.1.jar,commons-lang-0.1-dev.jar,commons-logging-1.0.jar,\
  +commons-util-1.0-rc2-dev.jar,dom4j-1.3.jar,jdepend-2.2.jar,log4j-1.1.3.jar\
  +oro-2.0.6.jar,regexp-1.2.jar,velocity-1.3-dev.jar,velocity-dvsl-0.43.jar,\
  +maven.jar
  
  
  
  1.93      +21 -3     jakarta-turbine-maven/build-bootstrap.xml
  
  Index: build-bootstrap.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- build-bootstrap.xml       1 Jun 2002 17:50:50 -0000       1.92
  +++ build-bootstrap.xml       3 Jun 2002 03:44:55 -0000       1.93
  @@ -145,10 +145,21 @@
     <!-- available until maven is built.                                    -->
     <!-- ================================================================== -->
   
  -  <target
  -    name="update-jars"
  -    depends="phase1-compile,make-lib-repo-dir">
  +  <target name="get-jars-no-proxy" unless="maven.proxy.host">
  +    <taskdef
  +      name="get-list"
  +      classname="org.apache.maven.ant.GetList">
  +      <classpath refid="pre-bootstrap-classpath"/>
  +    </taskdef>
   
  +    <get-list
  +      listFile="jars.list"
  +      dest="${lib.repo}"
  +      baseUrl="${maven.get.jars.baseUrl}/"
  +    />
  +  </target>
  +
  +  <target name="get-jars-proxy" if="maven.proxy.host">
       <taskdef
         name="get-list"
         classname="org.apache.maven.ant.GetList">
  @@ -159,7 +170,14 @@
         listFile="jars.list"
         dest="${lib.repo}"
         baseUrl="${maven.get.jars.baseUrl}/"
  +      proxyHost="${maven.proxy.host}"
  +      proxyPort="${maven.proxy.port}"
       />
  +  </target>
  +  
  +  <target
  +    name="update-jars"
  +    depends="phase1-compile,make-lib-repo-dir,get-jars-proxy,get-jars-no-proxy">
     
     </target>
   
  
  
  
  1.6       +17 -0     
jakarta-turbine-maven/src/templates/build/plugins/core/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/default.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- default.properties        27 May 2002 21:25:27 -0000      1.5
  +++ default.properties        3 Jun 2002 03:44:56 -0000       1.6
  @@ -170,6 +170,18 @@
   # -------------------------------------------------------------------
   # This needs to be changed before prime time.
   maven.updateSite = http://www.apache.org/~jvanzyl/maven/update
  +# jars needed in lib.repo by maven to execute
  +# this property is a replacement for jars.list. See the info in
  +# src/templates/build/plugins/core/build-init.xml about what needs to be
  +# done to remove jars.list from maven
  +maven.jars.list=antlr-2.7.1.jar,bcel-5.0.jar,checkstyle-2.2.jar,\
  +commons-beanutils-dev.jar,commons-betwixt-1.0-dev.jar,\
  +commons-collections-2.0.jar,commons-digester-1.2.jar,commons-graph-0.8.jar,\
  +commons-io-0.1.jar,commons-lang-0.1-dev.jar,commons-logging-1.0.jar,\
  +commons-util-1.0-rc2-dev.jar,dom4j-1.3.jar,jdepend-2.2.jar,log4j-1.1.3.jar\
  +oro-2.0.6.jar,regexp-1.2.jar,velocity-1.3-dev.jar,velocity-dvsl-0.43.jar,\
  +maven.jar
  +
   
   # -------------------------------------------------------------------
   # M A V E N  D I S T R I B U T I O N S
  @@ -183,3 +195,8 @@
   # -------------------------------------------------------------------
   maven.scp.executable = scp
   maven.ssh.executable = ssh
  +
  +# -------------------------------------------------------------------
  +# Mark the defaults as loaded - PLEASE DON'T OVERRIDE
  +# -------------------------------------------------------------------
  +maven.defaults.loaded = true
  \ No newline at end of file
  
  
  
  1.3       +1 -0      
jakarta-turbine-maven/src/templates/build/plugins/core/Control.vm
  
  Index: Control.vm
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/Control.vm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Control.vm        28 May 2002 01:20:42 -0000      1.2
  +++ Control.vm        3 Jun 2002 03:44:56 -0000       1.3
  @@ -8,6 +8,7 @@
   $buildElements.add("plugins/$plugin/build.xml")
   $buildElements.add("plugins/$plugin/default.properties")
   $buildElements.add("plugins/$plugin/build-gump.xml")
  +$buildElements.add("plugins/$plugin/build-init.xml")
   
   ## -------------------------------------------------------
   ## Make the list of delegators
  
  
  
  1.1                  
jakarta-turbine-maven/src/templates/build/plugins/core/build-init.xml
  
  Index: build-init.xml
  ===================================================================
  <?xml version='1.0' encoding='UTF-8' ?>
  
  <!-- 
    Build file that holds initialization targets used across plugins
    
    Based on src/templates/build/build-init-target v1.37
    
    author:   dion
    version:  $Id: build-init.xml,v 1.1 2002/06/03 03:44:55 dion Exp $
  -->
  
  <project name="maven-init" default="verify-project">
    
    <target name="load-default-properties" unless="maven.defaults.loaded">
      <!-- Set default values for the build -->
      <property file="${maven.home}/plugins/core/default.properties" />
    </target>
  
    <!-- ================================================================== -->
    <!-- I N I T I A L I Z E                                                -->
    <!-- ================================================================== -->
    <!-- This deals with loading our path creation task that is used to:    -->
    <!--                                                                    --> 
    <!-- a) Construct a classpath from a descriptor file which allows us    -->
    <!--    to store our dependencies externally and makes a build          -->
    <!--    file reusable.                                                  -->
    <!--                                                                    -->
    <!-- b) Construct pattern sets that can be used for various task like   -->
    <!--    copying a set of resources into a JAR for deployment.           -->
    <!-- ================================================================== -->
  
    <target name="init">
      <!-- redefine maven-classpath, just in case someone forgot when calling -->
      <!-- These are the bare minimum set of JARs that maven needs to operate.
      We don't want to make a big JAR containing everything so we
      are creating a special maven-classpath reference which is
      used by the maven operations.
        
      To totally eliminate duplication of this list of files, and remove 
      the jars.list file, the bootstrap process needs to be updated so that the
      following target:task pairs no longer need jars.list
        1) update-jars:get-list
        2) phase2-compile:create-classpath
        3) dist:create-patternset
        4) project-map:create-classpath (see 2)
        5) generate-build:create-build-system
      -->
  
      <path id="maven-classpath">
        <fileset dir="${lib.repo}" includes="${maven.jars.list}" />
      </path>
      
      <!-- define maven taskdefs, as taskdefs are not yet inheritable -->
      <taskdef resource="maven-taskdefs.properties">
        <classpath refid="maven-classpath" />
      </taskdef>
    </target>
  
    <!-- ================================================================== -->
    <!-- V E R I F Y  P R O J E C T                                         -->
    <!-- ================================================================== -->
  
    <target
      name="verify-project" 
      description="o Update JARs required for building"
      depends="init,project-properties,load-default-properties,
               verify-project-proxy,verify-project-noproxy"
      if="verificationFailed">
      
      <fail message="">
      
      You are missing JARs that must be downloaded manually 
      before continuing with the build.
      
      </fail>
      
    </target>
  
    <target 
      name="prepare.httpget">    
      <!-- nothing yet -->
    </target>
  
    <target 
      name="verify-project-noproxy" 
      unless="proxy.host" 
      depends="prepare.httpget">
      
      <verify-project
        projectDescriptor="project.xml"
        mavenLocalRepo="${maven.repo.local}"
        mavenRemoteRepo="${maven.repo.remote}"
      />
    </target>    
  
    <target 
      name="verify-project-proxy" 
      if="maven.proxy.host" 
      depends="prepare.httpget">
  
      <verify-project
        projectDescriptor="project.xml"
        mavenLocalRepo="${maven.repo.local}"
        mavenRemoteRepo="${maven.repo.remote}"
        proxyHost="${maven.proxy.host}"
        proxyPort="${maven.proxy.port}"
      />
    </target>    
  
    <!-- ================================================================== -->
    <!-- P R O J E C T  P R O P E R T I E S                                 -->
    <!-- ================================================================== -->
  
    <target name="project-properties" depends="update-pom-check" 
      unless="maven.pomLoaded">
    
      <project-properties projectDescriptor="project.xml"/>
  
      <!-- Temporary to assist users of HEAD while the b3 users still 
           exist.  This will go away in b4. 
           
           FIXME: Is this still needed?
       -->
      <update-properties/>
  
      <tstamp>
        <format property="maven.current.year" pattern="yyyy" />
      </tstamp>
      
    </target>
  
    <target
      name="update-pom-check"
      unless="maven.pomChecked">
  
      <!-- Here is where we need to add checks to see that the descriptor
           is up-to-date. So we need to:
           
           o Check for that the project.xml file is well-formed
           o Get current version listed in the POM
           o Get the version required by Maven
           o If there is a mismatch then update the POM
           
           This task will place a property into the build called
           'maven.pomUpdateRequired' if the version of the POM is out of
           sync with what Maven expects.
      -->
      
      <update-pom-check
        projectDescriptor="project.xml"
      />      
  
      <antcall target="callUpdateDescriptor"/>
  
    </target>
  
    <target
      name="callUpdateDescriptor"
      if="maven.pomUpdateRequired">
      
      <antcall target="update-descriptor"/>
  
      <format-pom
        input="project.xml"
        output="project.xml.formatted"
      />
  
      <copy 
        tofile="project.xml" 
        file="project.xml.formatted"
        overwrite="true"
      />
  
      <delete file="project.xml.formatted"/>
  
    </target>
  
    <!-- ================================================================== -->
    <!-- U P D A T E  D E S C R I P T O R                                   -->
    <!-- ================================================================== -->
    <!-- Updates a project descriptor in XML form between different         -->
    <!-- versions of Maven.                                                 -->
    <!--                                                                    -->
    <!-- NOTE:                                                              -->
    <!-- This only accounts for a transformation across single version.     -->
    <!--                                                                    -->
    <!-- CONSTRAINTS:                                                       -->
    <!-- We need to make sure both ${maven.fromVersion} and                 -->
    <!-- ${maven.toVersion} are set and that we have a dvsl transformation  -->
    <!-- to handle the request.                                             -->
    <!-- ================================================================== -->
  
    <target
      name="updates-available">
      
      <echo>
      +------------------------------------------------------------------------------
      |
      | Updates available:
      | 
      | v1 to v2 -> ant -Dmaven.fromVersion=1 -Dmaven.toVersion=2 
maven:update-descriptor 
      |
      +------------------------------------------------------------------------------
      </echo>
      
    </target>
  
    <target 
      name="updateDvslExists"
      depends="fromVersion"
      if="maven.fromVersion">
      
      <available
        property="maven.updateDvslExists"
        value="true"
        
file="${maven.home}/update/v${maven.fromVersion}-v${maven.toVersion}/update-descriptor.dvsl"
      />
      
    </target>
  
    <target
      name="checkUpdateDescriptor"
      depends="updateDvslExists"
      unless="maven.updateDvslExists">
      
      <echo>
      +------------------------------------------------------------------------------
      |
      | ERROR: The specified update cannot be performed, please check your
      |        maven.toVersion and maven.fromVersion and try again. You can also use 
the
      |        'maven:available-updates' target to see which migration paths
      |        are available.
      |
      +------------------------------------------------------------------------------
      </echo>
      
    </target>
  
    <target 
      name="fromVersion"
      depends="toVersion"
      if="maven.toVersion">
    </target>
  
    <target 
      name="toVersion"
      if="maven.toVersion">
    </target>
    
    <target
      name="update-descriptor"
      depends="checkUpdateDescriptor"
      if="maven.updateDvslExists"
      description="o Update Maven project descriptor">
  
      <echo>
      +------------------------------------------------------------------------------
      | N O T I C E 
      +------------------------------------------------------------------------------
      |
      | Updating project descriptor from version ${maven.fromVersion}
      |   to version ${maven.toVersion}
      |
      +------------------------------------------------------------------------------
      </echo>
  
      <!-- Make a copy of the project descriptor before attempting
           to move it forward to the next version.
      -->
      <copy 
        tofile="project.xml.v${maven.fromVersion}" 
        file="project.xml"
      />
  
      <dvsl
        basedir="."
        destdir="./"
        extension=".xml"
        
style="${maven.home}/update/v${maven.fromVersion}-v${maven.toVersion}/update-descriptor.dvsl"
        in="project.xml"
        out="project.xml.${maven.toVersion}"
        toolboxfile="${maven.home}/stylesheets/toolbox.props"
      />
      
      <!-- Give our new project descriptor its proper name -->
      <copy 
        tofile="project.xml" 
        file="project.xml.${maven.toVersion}"
        overwrite="true"
      />
      
      <!-- Get rid of the temporary copy -->    
      <delete file="project.xml.${maven.toVersion}"/>
      
    </target>
  
    <!-- ================================================================== -->
    <!-- C A L L B A C K S  - generic tasks to handle checking and          -->
    <!-- ant running of a callback, if files and properties are provided    -->
    <!-- must pass buildFile, buildTarget, buildTargetName to these targets -->
    <!-- ================================================================== -->
  
    <target name="callback-check">
      <condition property="maven.callback.ok">
        <and>
          <available file="${buildFile}"/>
          <not>
            <equals arg1="${buildTarget}"
                    arg2="$${${buildTargetName}}" />
          </not>
        </and>
      </condition>
    </target>
    
    <target name="callback" depends="callback-check" if="maven.callback.ok">
      <!-- not sure about exporting from callbacks yet.... -->
      <maven-ant antfile="${buildFile}" target="${buildTarget}" 
        inheritRefs="true" />
  
    </target>
  
  </project>
  
  
  
  1.5       +1 -0      jakarta-turbine-maven/src/java/org/apache/maven/ant/GetList.java
  
  Index: GetList.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ant/GetList.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GetList.java      27 May 2002 12:25:44 -0000      1.4
  +++ GetList.java      3 Jun 2002 03:44:56 -0000       1.5
  @@ -124,6 +124,7 @@
        */
       public void setProxyPort(String proxyPort)
       {
  +        System.getProperties().put("proxySet", "true");
           System.getProperties().put("proxyPort", proxyPort);
       }
   
  
  
  
  1.6       +10 -7     
jakarta-turbine-maven/src/java/org/apache/maven/UpdatePomCheck.java
  
  Index: UpdatePomCheck.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/UpdatePomCheck.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UpdatePomCheck.java       1 Jun 2002 20:59:42 -0000       1.5
  +++ UpdatePomCheck.java       3 Jun 2002 03:44:56 -0000       1.6
  @@ -83,7 +83,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author dion
    * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a>
  - * @version $Id: UpdatePomCheck.java,v 1.5 2002/06/01 20:59:42 jvanzyl Exp $
  + * @version $Id: UpdatePomCheck.java,v 1.6 2002/06/03 03:44:56 dion Exp $
    */
   public class UpdatePomCheck extends AbstractExecutor
   {
  @@ -139,17 +139,20 @@
           if (Integer.parseInt(project.getPomVersion()) !=
               MavenConstants.POM_VERSION)
           {
  -            getProject().setProperty("pomUpdateRequired", "true");
  -            getProject().setProperty("fromVersion", project.getPomVersion());
  -            getProject().setProperty("toVersion",
  +            getProject().setProperty("maven.pomUpdateRequired", "true");
  +            getProject().setProperty("maven.fromVersion", 
  +                project.getPomVersion());
  +            getProject().setProperty("maven.toVersion",
                   Integer.toString(MavenConstants.POM_VERSION));
   
  -            log("fromVersion -> " + project.getPomVersion());
  -            log("  toVersion -> " + MavenConstants.POM_VERSION);
  +            log("maven.fromVersion -> " + project.getPomVersion(),
  +                org.apache.tools.ant.Project.MSG_DEBUG);
  +            log("  maven.toVersion -> " + MavenConstants.POM_VERSION,
  +                org.apache.tools.ant.Project.MSG_DEBUG);
   
           }
   
           // Let the build system know that we have checked the POM.
  -        getProject().setProperty("pomChecked", "true");
  +        getProject().setProperty("maven.pomChecked", "true");
       }
   }
  
  
  

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

Reply via email to