using ant-contrib with IntelliJ version 12

The following worked for me. Please advise me if you had a better method.

Step0. create an Ant script like "build_for_debug.xml"
Step1. add the script to the Ant Build Tool Window (you can find it in the very right vertical side bar or in the main manu View > Tool Windows > Ant Build)
          just drap-and-drop the ant build file from the project window to the ant build window
Step2. add the path to ant-contrib :
          * in the Ant Build Tool Window select the "build_for_debug.xml" item and right-click (or on the window menu) to "Properties"
          * choose "Additional ClassPath" and "Add" : select the ant-contrib-1.0b3.jar file from any specific folder on your system
Step3. declare the ant-contrib features in "build_for_debug.xml" before using them :
          <taskdef resource="net/sf/antcontrib/" />

Example Ant Build file :

<taskdef resource="net/sf/antcontrib/" />

<echo message="The current user is : ${}" />
<property name="current_user_of_this_script.value" value="${}" />
     <equals arg1="${current_user_of_this_script.value}" arg2="myspecificusernameonmycomputer"/>
           <var name="deploy_source_jar_files_folder.dir" value="/Users/myspecificusernameonmycomputer/Dropbox/myproject_sw_deploy_jar_files" />
     <isset property="deploy_source_jar_files_folder.dir"/>
           <copy todir="${deploy_source_jar_files_folder.dir}">
                <fileset dir="${dist.dir}" />
               <format property="TODAY_FR" pattern="yyyy-MM-dd HH:mm:ss zzz" locale="fr,FR"/>
          <echo>the current date is ${TODAY_FR}</echo>
          <echo file="${deploy_source_jar_files_folder.dir}/alljarfileslog.txt" append="true">${specific.prjname}.jar ${TODAY_FR} ${dist.dir}${specific.prjname}.jar</echo>
1 comment
Comment actions Permalink


But what is the problem?

I've checked my test project. There ant file has no additional classpath, and the ant contrib is defined like:

    <taskdef resource="net/sf/antcontrib/">
            <pathelement location="./lib/ant-contrib-1.0b3.jar"/>

But I believe, this is not the only or "best" method, just one that works.


Message was edited by: Alexander Chernikov


Please sign in to leave a comment.