Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch java symlink creation to use CMD to avoid PS upgrade #795

Merged
merged 1 commit into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,9 @@
when: (java11_installed.stat.exists == false)
tags: Java11

- name: Test if Java11 symlink is already created
win_stat:
path: 'C:\openjdk\jdk-11'
register: java11_symlink
tags: Java11

- name: Get Java 11 Folder name to create symlink
win_shell: powershell ([Environment]::SetEnvironmentVariable("Java11_Folder", (Get-ChildItem -Path 'C:\Program Files\Java\jdk-11*' | Select-String -Pattern 'C*'), "Machine"))
when: (java11_symlink.stat.exists == false)
tags: Java11

- name: Create symlink to Java 11
win_shell: New-Item -Path 'C:\openjdk\jdk-11' -ItemType SymbolicLink -Value ([Environment]::GetEnvironmentVariable("Java11_Folder", "Machine"))
- name: Create symlink to directory without spaces if not already there
win_shell: for /D %a in ("C:\Program Files\Java\jdk-11*") do IF NOT EXIST "C:\openjdk\jdk-11" MKLINK /D "C:\openjdk\jdk-11" "%a"
args:
executable: powershell
when: (java11_symlink.stat.exists == false)
executable: cmd.exe
creates: 'C:\openjdk\jdk-11'
tags: Java11
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,9 @@
when: (java12_installed.stat.exists == false)
tags: Java12

- name: Test if Java12 symlink is already created
win_stat:
path: 'C:\openjdk\jdk-12'
register: java12_symlink
tags: Java12

- name: Get Java 12 Folder name to create symlink
win_shell: powershell ([Environment]::SetEnvironmentVariable("Java12_Folder", (Get-ChildItem -Path 'C:\Program Files\Java\jdk-12*' | Select-String -Pattern 'C*'), "Machine"))
when: (java12_symlink.stat.exists == false)
tags: Java12

- name: Create symlink to Java 12
win_shell: New-Item -Path 'C:\openjdk\jdk-12' -ItemType SymbolicLink -Value ([Environment]::GetEnvironmentVariable("Java12_Folder", "Machine"))
- name: Create symlink to directory without spaces if not already there
win_shell: for /D %a in ("C:\Program Files\Java\jdk-12*") do IF NOT EXIST "C:\openjdk\jdk-12" MKLINK /D "C:\openjdk\jdk-12" "%a"
args:
executable: powershell
when: (java12_symlink.stat.exists == false)
executable: cmd.exe
creates: 'C:\openjdk\jdk-12'
tags: Java12
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,11 @@
when: (java8_installed.stat.exists == false)
tags: Java8

- name: Test if Java 8 symlink is already created
win_stat:
path: 'C:\openjdk\jdk-8'
register: java8_symlink
tags: Java8

- name: Get Java 8 Folder name to create symlink
win_shell: powershell ([Environment]::SetEnvironmentVariable("Java8_Folder", (Get-ChildItem -Path 'C:\Program Files\Java\jdk8*' | Select-String -Pattern 'C*'), "Machine"))
when: (java8_symlink.stat.exists == false)
tags: Java8

- name: Create symlink to Java 8
win_shell: New-Item -Path 'C:\openjdk\jdk-8' -ItemType SymbolicLink -Value ([Environment]::GetEnvironmentVariable("Java8_Folder", "Machine"))
- name: Create symlink to directory without spaces if not already there
win_shell: for /D %a in ("C:\Program Files\Java\jdk8*") do IF NOT EXIST "C:\openjdk\jdk-8" MKLINK /D "C:\openjdk\jdk-8" "%a"
karianna marked this conversation as resolved.
Show resolved Hide resolved
args:
executable: powershell
when: (java8_symlink.stat.exists == false)
executable: cmd.exe
creates: 'C:\openjdk\jdk-8'
tags: Java8

- name: Set JAVA_HOME to version 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,9 @@
when: (java9_installed.stat.exists == false)
tags: Java9

- name: Test if Java 9 symlink is already created
win_stat:
path: 'C:\openjdk\jdk-9'
register: java9_symlink
tags: Java9

- name: Get Java 9 Folder name to create symlink
win_shell: powershell ([Environment]::SetEnvironmentVariable("Java9_Folder", (Get-ChildItem -Path 'C:\Program Files\Java\jdk-9*' | Select-String -Pattern 'C*'), "Machine"))
when: (java9_symlink.stat.exists == false)
tags: Java9

- name: Create symlink to Java 9
win_shell: New-Item -Path 'C:\openjdk\jdk-9' -ItemType SymbolicLink -Value ([Environment]::GetEnvironmentVariable("Java9_Folder", "Machine"))
- name: Create symlink to directory without spaces if not already there
win_shell: for /D %a in ("C:\Program Files\Java\jdk-9*") do IF NOT EXIST "C:\openjdk\jdk-9" MKLINK /D "C:\openjdk\jdk-9" "%a"
args:
executable: powershell
when: (java9_symlink.stat.exists == false)
executable: cmd.exe
creates: 'C:\openjdk\jdk-9'
tags: Java9