diff --git a/roles/java/tasks/main.yml b/roles/java/tasks/main.yml index e72e99b5..6c162b8d 100644 --- a/roles/java/tasks/main.yml +++ b/roles/java/tasks/main.yml @@ -1,152 +1,157 @@ --- -- name: Install - ansible.builtin.dnf: - name: - - ant - - java-1.8.0-openjdk-devel - - java-11-openjdk-devel - - java-11-openjdk-src - - java-17-openjdk-devel - - java-17-openjdk-src - - jacoco # JaCoCo is a free code coverage library for Java - state: present - become: true +- name: Java tags: - java - jdk - - openjdk + block: + - name: Install + ansible.builtin.dnf: + name: + - ant + - java-1.8.0-openjdk-devel + - java-11-openjdk-devel + - java-11-openjdk-src + - java-17-openjdk-devel + - java-17-openjdk-src + - jacoco # JaCoCo is a free code coverage library for Java + state: present + become: true + tags: + - java + - jdk + - openjdk -- name: Install scala - ansible.builtin.dnf: - name: - - scala - state: present - become: true - tags: - - never - - scala + - name: Install scala + ansible.builtin.dnf: + name: + - scala + state: present + become: true + tags: + - never + - scala -- name: Create items - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: "0755" - loop: - - "{{ ansible_user_dir }}/.local/share/java" - tags: - - java - - jdk - - openjdk + - name: Create items + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: "0755" + loop: + - "{{ ansible_user_dir }}/.local/share/java" + tags: + - java + - jdk + - openjdk -- name: Fetch PMD binary (https://github.com/pmd/pmd) - ansible.builtin.unarchive: - src: https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.0.0-rc3/pmd-dist-7.0.0-rc3-bin.zip - dest: "{{ ansible_user_dir }}/opt/" - remote_src: true - tags: - - java - - pmd + - name: Fetch PMD binary (https://github.com/pmd/pmd) + ansible.builtin.unarchive: + src: https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.0.0-rc3/pmd-dist-7.0.0-rc3-bin.zip + dest: "{{ ansible_user_dir }}/opt/" + remote_src: true + tags: + - java + - pmd -- name: Create PMD binary wrapper - ansible.builtin.copy: - dest: "{{ ansible_user_dir }}/.local/bin/pmd" - content: | - #!/usr/bin/env bash + - name: Create PMD binary wrapper + ansible.builtin.copy: + dest: "{{ ansible_user_dir }}/.local/bin/pmd" + content: | + #!/usr/bin/env bash - export PMD_JAVA_OPTS="$_JAVA_OPTIONS" - unset _JAVA_OPTIONS - exec "{{ ansible_user_dir }}/opt/pmd-bin-7.0.0-rc3/bin/pmd" "$@" - mode: "0755" - tags: - - java - - pmd + export PMD_JAVA_OPTS="$_JAVA_OPTIONS" + unset _JAVA_OPTIONS + exec "{{ ansible_user_dir }}/opt/pmd-bin-7.0.0-rc3/bin/pmd" "$@" + mode: "0755" + tags: + - java + - pmd -- name: Check latest spotbugs (https://github.com/spotbugs/spotbugs) - ansible.builtin.uri: - url: https://api.github.com/repos/spotbugs/spotbugs/releases/latest - return_content: true - register: spotbugs - tags: - - java - - spotbugs + - name: Check latest spotbugs (https://github.com/spotbugs/spotbugs) + ansible.builtin.uri: + url: https://api.github.com/repos/spotbugs/spotbugs/releases/latest + return_content: true + register: spotbugs + tags: + - java + - spotbugs -- name: Unpack latest spotbugs - ansible.builtin.unarchive: - src: https://github.com/spotbugs/spotbugs/releases/download/{{ spotbugs['json']['tag_name'] }}/spotbugs-{{ spotbugs['json']['tag_name'] }}.tgz - dest: "{{ ansible_user_dir }}/opt" - remote_src: true - tags: - - java - - spotbugs + - name: Unpack latest spotbugs + ansible.builtin.unarchive: + src: https://github.com/spotbugs/spotbugs/releases/download/{{ spotbugs['json']['tag_name'] }}/spotbugs-{{ spotbugs['json']['tag_name'] }}.tgz + dest: "{{ ansible_user_dir }}/opt" + remote_src: true + tags: + - java + - spotbugs -- name: Make spotbugs executable - ansible.builtin.file: - path: "{{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/{{ item }}" - mode: "0755" - loop: - - spotbugs - tags: - - java - - spotbugs + - name: Make spotbugs executable + ansible.builtin.file: + path: "{{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/{{ item }}" + mode: "0755" + loop: + - spotbugs + tags: + - java + - spotbugs -- name: Symlink binary - ansible.builtin.file: - src: "{{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/{{ item }}" - dest: "{{ ansible_user_dir }}/.local/bin/{{ item }}" - state: link - loop: - - spotbugs - tags: - - java - - spotbugs + - name: Symlink binary + ansible.builtin.file: + src: "{{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/{{ item }}" + dest: "{{ ansible_user_dir }}/.local/bin/{{ item }}" + state: link + loop: + - spotbugs + tags: + - java + - spotbugs -- name: Create spotbugs desktop file integration - ansible.builtin.copy: - dest: "{{ ansible_user_dir }}/.local/share/applications/spotbugs.desktop" - content: | - [Desktop Entry] - Name=Spotbugs - Exec=spotbugs %U - Terminal=false - Type=Application - Icon={{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/spotbugs.ico - Categories=Development; - StartupNotify=true - StartupWMClass=spotbugs - mode: "0644" - tags: - - java - - spotbugs + - name: Create spotbugs desktop file integration + ansible.builtin.copy: + dest: "{{ ansible_user_dir }}/.local/share/applications/spotbugs.desktop" + content: | + [Desktop Entry] + Name=Spotbugs + Exec=spotbugs %U + Terminal=false + Type=Application + Icon={{ ansible_user_dir }}/opt/spotbugs-{{ spotbugs['json']['tag_name'] }}/bin/spotbugs.ico + Categories=Development; + StartupNotify=true + StartupWMClass=spotbugs + mode: "0644" + tags: + - java + - spotbugs -- name: Check latest checkstyle (https://github.com/checkstyle/checkstyle) - ansible.builtin.uri: - url: https://api.github.com/repos/checkstyle/checkstyle/releases/latest - return_content: true - register: checkstyle - tags: - - java - - checkstyle + - name: Check latest checkstyle (https://github.com/checkstyle/checkstyle) + ansible.builtin.uri: + url: https://api.github.com/repos/checkstyle/checkstyle/releases/latest + return_content: true + register: checkstyle + tags: + - java + - checkstyle -- name: Fetch latest checkstyle - ansible.builtin.get_url: - url: https://github.com/checkstyle/checkstyle/releases/download/{{ checkstyle['json']['tag_name'] }}/{{ checkstyle['json']['tag_name'] }}-all.jar - dest: "{{ ansible_user_dir }}/opt/{{ checkstyle['json']['tag_name'] }}-all.jar" - mode: "0644" - force: true - tags: - - java - - checkstyle + - name: Fetch latest checkstyle + ansible.builtin.get_url: + url: https://github.com/checkstyle/checkstyle/releases/download/{{ checkstyle['json']['tag_name'] }}/{{ checkstyle['json']['tag_name'] }}-all.jar + dest: "{{ ansible_user_dir }}/opt/{{ checkstyle['json']['tag_name'] }}-all.jar" + mode: "0644" + force: true + tags: + - java + - checkstyle -- name: Create checkstyle binary wrapper - ansible.builtin.copy: - dest: "{{ ansible_user_dir }}/.local/bin/checkstyle" - content: | - #!/usr/bin/env bash + - name: Create checkstyle binary wrapper + ansible.builtin.copy: + dest: "{{ ansible_user_dir }}/.local/bin/checkstyle" + content: | + #!/usr/bin/env bash - export CHECKSTYLE_JAVA_OPTS="$_JAVA_OPTIONS" - unset _JAVA_OPTIONS - exec java $CHECKSTYLE_JAVA_OPTS -jar "{{ ansible_user_dir }}/opt/{{ checkstyle['json']['tag_name'] }}-all.jar" "$@" - mode: "0755" - tags: - - java - - checkstyle + export CHECKSTYLE_JAVA_OPTS="$_JAVA_OPTIONS" + unset _JAVA_OPTIONS + exec java $CHECKSTYLE_JAVA_OPTS -jar "{{ ansible_user_dir }}/opt/{{ checkstyle['json']['tag_name'] }}-all.jar" "$@" + mode: "0755" + tags: + - java + - checkstyle