add java ls

This commit is contained in:
Bartal Laearsson
2026-06-29 14:12:43 +01:00
parent 562078faf9
commit cad054d468
4 changed files with 63 additions and 38 deletions
+57
View File
@@ -0,0 +1,57 @@
---
- name: Check for Eclipse JDT Language Server
ansible.builtin.stat:
path: "{{ jdtls_install_dir }}/bin/jdtls"
become: false
register: jdtls_binary
- name: Create JDT LS installation directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ user_name }}"
mode: "0755"
become: false
loop:
- "{{ jdtls_install_dir }}"
- "{{ user_home }}/.local/bin"
- name: Read the JDT LS milestone archive name
ansible.builtin.uri:
url: "{{ jdtls_base_url }}/latest.txt"
return_content: true
become: false
register: jdtls_latest
when: not jdtls_binary.stat.exists
- name: Download Eclipse JDT Language Server
ansible.builtin.get_url:
url: "{{ jdtls_base_url }}/{{ jdtls_latest.content | trim }}"
dest: "{{ jdtls_archive }}"
mode: "0644"
checksum: "sha256:{{ jdtls_base_url }}/{{ jdtls_latest.content | trim }}.sha256"
become: false
when: not jdtls_binary.stat.exists
- name: Extract Eclipse JDT Language Server
ansible.builtin.unarchive:
src: "{{ jdtls_archive }}"
dest: "{{ jdtls_install_dir }}"
remote_src: true
creates: "{{ jdtls_install_dir }}/bin/jdtls"
become: false
when: not jdtls_binary.stat.exists
- name: Link jdtls into the user's PATH
ansible.builtin.file:
src: "{{ jdtls_install_dir }}/bin/jdtls"
dest: "{{ user_home }}/.local/bin/jdtls"
state: link
force: true
become: false
- name: Remove downloaded JDT LS archive
ansible.builtin.file:
path: "{{ jdtls_archive }}"
state: absent
become: false