THRIFT-3677 Improve CMake Java build

This closes #897
diff --git a/appveyor.yml b/appveyor.yml
index 61c5f9a..f36c7f0 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -53,27 +53,32 @@
 - move *.h include\
 - cd ..
 - cinst winflexbison
-- cinst nsis
-# TODO: Enable Java build
 # - cinst ant -ignoreDependencies
+- cd \
+- appveyor DownloadFile http://www.us.apache.org/dist//ant/binaries/apache-ant-1.9.6-bin.zip
+- 7z x apache-ant-1.9.6-bin.zip
+- cd %APPVEYOR_BUILD_FOLDER%
 # TODO: Enable Haskell build
 # - cinst HaskellPlatform -version 2014.2.0.0
 
 
 build_script:
-# - set PATH=C:\ProgramData\chocolatey\bin;C:\tools\apache-ant-1.9.4\bin;%PATH%
-# - set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
-# - set PATH=%JAVA_HOME%\bin;%PATH%
+- set PATH=C:\ProgramData\chocolatey\bin;C:\apache-ant-1.9.6\bin;%PATH%
+- set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
+- set PATH=%JAVA_HOME%\bin;%PATH%
 # - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
 # - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
 - set PATH=C:\Python27-x64;%PATH%
 - mkdir cmake-build
 - cd cmake-build
-- cmake -G "Visual Studio 14 2015 Win64" -DWITH_JAVA=OFF -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=%APPVEYOR_BUILD_FOLDER%\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT% -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR% ..
+- cmake -G "Visual Studio 14 2015 Win64" -DWITH_JAVA=ON -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=%APPVEYOR_BUILD_FOLDER%\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT% -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR% ..
+- findstr /b /e BUILD_COMPILER:BOOL=ON CMakeCache.txt
+- findstr /b /e BUILD_JAVA:BOOL=ON CMakeCache.txt
+- findstr /b /e BUILD_TESTING:BOOL=ON CMakeCache.txt
 # - cmake --build .
 - cmake --build . --config Release
 # TODO: Fix cpack
 # - cpack
-- ctest -C Release -VV -E "(concurrency_test|processor_test|python_test$|^Python)"
+- ctest -C Release -VV -E "(concurrency_test|processor_test|python_test$|^Python|^Java)"
 
 #TODO make it perfect ;-r