Show
Ignore:
Timestamp:
27.07.2015 23:22:01 (4 years ago)
Author:
davidb
Message:

Replacement of NetBeans? based ant compile files with much simpler build.xml that only needs a Java JDK, not a Java EE to compile and be deployed

Location:
other-projects/the-macronizer/trunk
Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/the-macronizer/trunk/build.xml

    r29855 r30063  
    1 <?xml version="1.0" encoding="UTF-8"?> 
    2 <!-- You may freely edit this file. See commented blocks below for --> 
    3 <!-- some examples of how to customize the build. --> 
    4 <!-- (If you delete it and reopen the project it will be recreated.) --> 
    5 <!-- By default, only the Clean and Build commands use this build script. --> 
    6 <!-- Commands such as Run, Debug, and Test only use this build script if --> 
    7 <!-- the Compile on Save feature is turned off for the project. --> 
    8 <!-- You can turn off the Compile on Save (or Deploy on Save) setting --> 
    9 <!-- in the project's Project Properties dialog box.--> 
    10 <project name="MIrefact" default="default" basedir="."> 
    11     <description>Builds, tests, and runs the project MIrefact.</description> 
    12     <import file="nbproject/build-impl.xml"/> 
    13     <!-- 
     1<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
     2<project basedir="." default="war" name="TheMacronizer"> 
    143 
    15     There exist several targets which are by default empty and which can be  
    16     used for execution of your tasks. These targets are usually executed  
    17     before and after some main targets. They are:  
     4  <property environment="env"/> 
    185 
    19       -pre-init:                 called before initialization of project properties  
    20       -post-init:                called after initialization of project properties  
    21       -pre-compile:              called before javac compilation  
    22       -post-compile:             called after javac compilation  
    23       -pre-compile-single:       called before javac compilation of single file 
    24       -post-compile-single:      called after javac compilation of single file 
    25       -pre-compile-test:         called before javac compilation of JUnit tests 
    26       -post-compile-test:        called after javac compilation of JUnit tests 
    27       -pre-compile-test-single:  called before javac compilation of single JUnit test 
    28       -post-compile-test-single: called after javac compilation of single JUunit test 
    29       -pre-dist:                 called before archive building  
    30       -post-dist:                called after archive building  
    31       -post-clean:               called after cleaning build products  
    32       -pre-run-deploy:           called before deploying 
    33       -post-run-deploy:          called after deploying 
    34  
    35     Example of pluging an obfuscator after the compilation could look like  
    36  
    37         <target name="-post-compile"> 
    38             <obfuscate> 
    39                 <fileset dir="${build.classes.dir}"/> 
    40             </obfuscate> 
    41         </target> 
    42  
    43     For list of available properties check the imported  
    44     nbproject/build-impl.xml file.  
     6  <property name="dist.dir.exp" location="releases" /> 
     7   
     8  <property name="dist.filename.exp"   value="TheMacronizer.war" /> 
     9  <property name="build.dir.exp"   location="web" /> 
     10  <property name="lib.dir.exp"  location="web/WEB-INF/lib" /> 
     11   
     12  <!-- 
     13      If changing these values, make sure you run 'ant clean' 
     14  --> 
     15  <property name="javac.source" value="1.8" /> 
     16  <property name="javac.target" value="${javac.source}" /> 
     17  <property name="javac.debug"  value="true" /> 
    4518 
    4619 
    47     Other way how to customize the build is by overriding existing main targets. 
    48     The target of interest are:  
     20  <path id="classpath.exp"> 
     21    <fileset dir="${lib.dir.exp}"> 
     22    <include name="*.jar" /> 
     23    </fileset> 
     24  </path> 
     25     
     26   
     27  <target name="clean"> 
     28    <!-- delete only the class files built by themacronizer --> 
     29    <delete dir="${build.dir.exp}/WEB-INF/classes"/> 
     30  </target> 
    4931 
    50       init-macrodef-javac:    defines macro for javac compilation 
    51       init-macrodef-junit:   defines macro for junit execution 
    52       init-macrodef-debug:    defines macro for class debugging 
    53       do-dist:                archive building 
    54       run:                    execution of project  
    55       javadoc-build:          javadoc generation  
     32   
     33  <target name="init"> 
     34    <echo message="${ant.project.name}: ${ant.file}"/> 
     35    <mkdir dir="${build.dir.exp}/WEB-INF/classes"/> 
     36    <mkdir dir="${build.dir.exp}/WEB-INF/classes/monogram"/> 
     37    <copy includeemptydirs="false" todir="${build.dir.exp}/WEB-INF/classes/monogram/data"> 
     38      <fileset dir="src/java/monogram/data" /> 
     39    </copy> 
     40  </target> 
     41     
     42  <target depends="init" name="build"> 
     43    <javac source="${javac.source}" target="${javac.target}" debug="${javac.debug}" 
     44       encoding="utf-8" 
     45           destdir="${build.dir.exp}/WEB-INF/classes" includeantruntime="false">                                 
     46      <src path="src"/> 
     47             
     48      <classpath> 
     49    <path refid="classpath.exp"/> 
     50    <pathelement location="src/jars/servlet-api.jar"/> 
     51    <pathelement path="src/java"/>             
     52      </classpath> 
     53    </javac> 
     54  </target> 
    5655 
    57     Example of overriding the target for project execution could look like  
    58  
    59         <target name="run" depends="<PROJNAME>-impl.jar"> 
    60             <exec dir="bin" executable="launcher.exe"> 
    61                 <arg file="${dist.jar}"/> 
    62             </exec> 
    63         </target> 
    64  
    65     Notice that overridden target depends on jar target and not only on  
    66     compile target as regular run target does. Again, for list of available  
    67     properties which you can use check the target you are overriding in  
    68     nbproject/build-impl.xml file.  
    69  
    70     --> 
     56     
     57  <target depends="build" name="war"> 
     58    <jar destfile="${dist.filename.exp}">   
     59      <fileset dir="${build.dir.exp}" /> 
     60    </jar> 
     61  </target> 
     62   
    7163</project>