jvanzyl     2002/06/27 20:31:23

  Added:       src/plugins/struts build.xml
  Log:
  
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-maven/src/plugins/struts/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version='1.0' encoding='UTF-8' ?>
  
  <project name="maven-struts" default="validate-struts-war" basedir="..">
  
    <!-- ================================================================== -->
    <!-- I N I T                                                            -->
    <!-- ================================================================== -->
    <target name="init" unless="maven.init">
      <taskdef
        name="create-classpath"
        classname="org.apache.maven.ant.CreateClasspath">
        <classpath>
          <pathelement location="${lib.repo}/maven.jar"/>
        </classpath>
      </taskdef>
      
      <create-classpath
        listFile="${maven.home}/plugins/core/jars.list"
        reference="pre-maven-classpath"
        baseDir="${lib.repo}"
      />
      
      <path id="maven-classpath">
        <path refid="pre-maven-classpath"/>
        <pathelement location="${lib.repo}/maven.jar"/>
      </path>
      
      <!-- define maven taskdefs, as taskdefs are not yet inheritable? -->
      <taskdef resource="maven-taskdefs.properties">
        <classpath refid="maven-classpath" />
      </taskdef>
      
      <property name="maven.init" value="true" />
      
      <!-- call common build file initialization to verify project, update jars
           load project and default properties etc -->
      <maven-ant antfile="${maven.home}/plugins/core/build-init.xml"
        target="verify-project" 
        inheritAll="true" 
        inheritRefs="true" 
        exportAll="true"
        exportRefs="true"/>
        
    </target>
  
    <!-- ================================================================== -->
    <!-- L O C A L   I N I T                                                -->
    <!-- ================================================================== -->
  
    <target name="local-init" depends="init">
      <!-- Pick up j2ee defaults -->
      <property file="${maven.home}/plugins/j2ee/default.properties"/>
      <!-- Pick up struts defaults -->
      <property file="${maven.home}/plugins/struts/default.properties"/>
      <!-- validate-struts-war -->
      <condition property="maven.struts.callback.pre-validate-struts-war.ok">
        <and>
          <available 
file="${maven.struts.callback.pre-validate-struts-war.buildFile}"/>
          <not>
            <equals arg1="${maven.struts.callback.pre-validate-struts-war.buildTarget}"
                    
arg2="$${maven.struts.callback.pre-validate-struts-war.buildTarget}" />
          </not>
        </and>
      </condition>
  
      <condition property="maven.struts.callback.post-validate-struts-war.ok">
        <and>
          <available 
file="${maven.struts.callback.post-validate-struts-war.buildFile}"/>
          <not>
            <equals 
arg1="${maven.struts.callback.post-validate-struts-war.buildTarget}"
                    
arg2="$${maven.struts.callback.post-validate-struts-war.buildTarget}" />
          </not>
        </and>
      </condition>
  
    </target>
  
    <!-- ================================================================== -->
    <!-- V A L I D A T E - S T R U T S - W A R                              -->
    <!-- ================================================================== -->
    
    <!-- validate a struts war file -->
    <target name="validate-struts-war" depends="local-init, 
      validate-struts-war-init, validate-struts-war-error, 
      pre-validate-struts-war-callback, validate,
      post-validate-struts-war-callback"/>
  
    <!-- make sure properties and files are available -->
    <target name="validate-struts-war-init">
      <condition property="maven.struts.validate-struts-war.ready">
        <and>
          <not>
            <equals arg1="${maven.j2ee.war.name}" arg2="$${maven.j2ee.war.name}"/>
          </not>
          <available file="${maven.build.dir}/${maven.j2ee.war.name}.war"
            type="file"/>
        </and>
      </condition>
    </target>
  
    <!-- fail if properties and files aren't available -->
    <target name="validate-struts-war-error" 
      unless="maven.struts.validate-struts-war.ready">
      <fail>
      +------------------------------------------------------------------------------
      |
      | ERROR: One of the required properties for maven:validate-struts-war was 
      |        not provided.
      |
      |        Please ensure that the property maven.j2ee.war.name is defined:
      |
      |        maven.j2ee.war.name = ${maven.j2ee.war.name}
      |
      |        and the following file exists:
      |
      |        ${maven.build.dir}/${maven.j2ee.war.name}.war
      +------------------------------------------------------------------------------
      </fail>
    </target>
  
    <!-- process any user defined pre validation callback -->
    <target name="pre-validate-struts-war-callback"
      if="maven.struts.callback.pre-validate-struts-war.ok">
      <maven-ant antfile="${maven.struts.callback.pre-validate-struts-war.buildFile}" 
        target="${maven.struts.callback.pre-validate-struts-war.buildTarget}"
        inheritRefs="true" exportAll="false" exportRefs="false"/>
    </target>
  
    <!-- perform the validation with a custom task -->
    <target name="validate">
      <struts10warvalidator
        warFileName="${maven.build.dir}/${maven.j2ee.war.name}.war">
        <formatter type="plain" usefile="false"/>
      </struts10warvalidator>
    </target>    
  
    <!-- process any user defined post validation callback -->  
    <target name="post-validate-struts-war-callback"
      if="maven.struts.callback.post-validate-struts-war.ok">
      <maven-ant antfile="${maven.struts.callback.post-validate-struts-war.buildFile}" 
        target="${maven.struts.callback.post-validate-struts-war.buildTarget}"
        inheritRefs="true" exportAll="false" exportRefs="false"/>
    </target>
  
  </project>
  
  
  

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

Reply via email to