--- - name: Check for JDT LS ansible.builtin.stat: path: "{{ jdtls_install_dir }}/plugins" become: false register: jdtls_installed - name: Create JDT LS target directories ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" loop: - "{{ jdtls_install_dir }}" - "{{ jdtls_bin_dir }}" become: false - name: Download Eclipse JDT LS ansible.builtin.get_url: url: "{{ jdtls_url }}" dest: "{{ jdtls_archive }}" mode: "0644" force: "{{ jdtls_force_update }}" timeout: "{{ jdtls_download_timeout }}" register: jdtls_download until: jdtls_download is succeeded retries: "{{ jdtls_download_retries }}" delay: "{{ jdtls_download_delay }}" when: jdtls_force_update or not jdtls_installed.stat.exists - name: Remove existing JDT LS install when forced ansible.builtin.file: path: "{{ jdtls_install_dir }}" state: absent become: false when: jdtls_force_update and jdtls_installed.stat.exists - name: Recreate JDT LS install directory ansible.builtin.file: path: "{{ jdtls_install_dir }}" state: directory mode: "0755" become: false when: jdtls_force_update and jdtls_installed.stat.exists - name: Extract Eclipse JDT LS ansible.builtin.unarchive: src: "{{ jdtls_archive }}" dest: "{{ jdtls_install_dir }}" remote_src: true become: false when: jdtls_force_update or not jdtls_installed.stat.exists - name: Check for bundled JDT LS launcher ansible.builtin.stat: path: "{{ jdtls_install_dir }}/bin/jdtls" become: false register: jdtls_bundled_launcher - name: Link bundled JDT LS launcher onto the user PATH ansible.builtin.file: src: "{{ jdtls_install_dir }}/bin/jdtls" dest: "{{ jdtls_bin_dir }}/jdtls" state: link force: true become: false when: jdtls_bundled_launcher.stat.exists - name: Create fallback JDT LS launcher ansible.builtin.copy: dest: "{{ jdtls_bin_dir }}/jdtls" mode: "0755" content: | #!/bin/bash set -euo pipefail JDTLS_HOME="{{ jdtls_install_dir }}" LAUNCHER_JAR=$(find "$JDTLS_HOME/plugins" -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -n 1) exec java \ -Declipse.application=org.eclipse.jdt.ls.core.id1 \ -Dosgi.bundles.defaultStartLevel=4 \ -Declipse.product=org.eclipse.jdt.ls.core.product \ -Dlog.protocol=true \ -Dlog.level=ALL \ -Xmx1G \ --add-modules=ALL-SYSTEM \ --add-opens java.base/java.util=ALL-UNNAMED \ --add-opens java.base/java.lang=ALL-UNNAMED \ -jar "$LAUNCHER_JAR" \ -configuration "$JDTLS_HOME/config_linux" \ -data "$PWD/.jdtls-workspace" \ "$@" become: false when: not jdtls_bundled_launcher.stat.exists - name: Remove downloaded JDT LS archive ansible.builtin.file: path: "{{ jdtls_archive }}" state: absent