Running ant task on windows

If you are building the code in linux or mac, you will not have to worry about the long classpath error. But you are using windows, then it is likely that you will run into following errors while running an Ant build

java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_73\bin\javac.exe"
(in directory "c:\<workspace folder>\pentaho-platform-ee\bi-platform-ee"): CreateProcess error=206, The filename or extension is too long

Possible solutions

Searching for the solutions on the web, I found a few workarounds 

Classpath attribute of manifest file

In this approach, you can create an empty jar file and specify all the jars in the classpath attribute of the manifest. For example, following section list the content of manifest file inside of jar.

Manifest-Version: 1.0
Class-Path:
 activation-1.1.jar
 annogen-0.1.0.jar
 antlr-complete-3.5.2.jar

Ant version 1.7, includes a new task 'manifestclasspath', which converts the classpath into space separated list of items. This can be used to set the class-path attribute of the manifest. 

<manifestclasspath property="jar.classpath"
                       jarfile="MyJar.jar">
      <classpath refid="classpath" />
</manifestclasspath>

Example Usage

Here is an example of using the above approach to resolve the long classpath issue while building pentaho-platform-extensions