---
  # "Convert the application"
  - name: "Check if the application is already built (do not convert)."
    find:
       paths: "{{ fwd_install_root }}/{{ fwd_app_name }}/build/lib/{{ fwd_app_name }}.jar"
    register: deploy_jars
    changed_when: false
  
  - name: "Convert and build the application"
    command: ant deploy deploy.prepare
    args:
       chdir: "{{ fwd_install_root }}/{{ fwd_app_name }}/"
    when: fwd_convert_app|bool and deploy_jars.matched|int == 0
      
  - name: "Build the embedded app"
    command: ant clean jar
    args:
       chdir: "{{ fwd_install_root }}/{{ fwd_app_name }}/embedded/"
    when: fwd_convert_app|bool and deploy_jars.matched|int == 0
