Repository navigation
Expand file tree
/
Copy pathdeveloper-java.pp
More file actions
123 lines (111 loc) · 3.75 KB
/
Copy pathdeveloper-java.pp
File metadata and controls
123 lines (111 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
###
# Puppet Script for a Java Developer Environment on Ubuntu
###
include apt
$maven_version = '3.9.16'
$javafx_17_version = '17.0.20'
$javafx_25_version = '25.0.4'
# Install Adoptium Temurin JDK 17 as default (oXygen XML Editor only support Oracle or Temurin JDKs), and JDK 25 (needed for Elemental)
apt::source { 'adoptium':
location => 'https://packages.adoptium.net/artifactory/deb',
release => $ubuntu_codename,
repos => 'main',
comment => 'adoptium',
key => {
name => 'adoptium.asc',
source => 'https://packages.adoptium.net/artifactory/api/gpg/key/public',
},
notify => Exec['apt_update'],
}
package { 'temurin-25-jdk':
ensure => installed,
require => [
Apt::Source['adoptium'],
Exec['apt_update'],
],
}
package { 'temurin-17-jdk':
ensure => installed,
require => [
Apt::Source['adoptium'],
Exec['apt_update'],
Package['temurin-25-jdk'],
],
}
~> exec { 'update-java-alternatives':
command => '/usr/sbin/update-java-alternatives --set temurin-17-jdk-amd64',
user => 'root',
require => Package['temurin-17-jdk'],
}
file_line { 'JAVA_HOME':
ensure => present,
path => '/etc/environment',
line => 'JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64',
match => '^JAVA_HOME\=',
require => Package['temurin-17-jdk'],
}
# Install JavaFX 25
exec { 'download-openjfx25':
command => "wget https://download2.gluonhq.com/openjfx/${javafx_25_version}/openjfx-${javafx_25_version}_linux-x64_bin-sdk.zip -O /tmp/openjfx-${javafx_25_version}_linux-x64_bin-sdk.zip",
path => '/usr/bin',
user => 'root',
creates => "/usr/lib/jvm/javafx-sdk-${javafx_25_version}",
require => Package['wget'],
} ~> exec { 'extract-openjfx25':
command => "unzip /tmp/openjfx-${javafx_25_version}_linux-x64_bin-sdk.zip -d /usr/lib/jvm",
path => '/usr/bin',
user => 'root',
creates => "/usr/lib/jvm/javafx-sdk-${javafx_25_version}",
require => Package['unzip'],
}
# Install JavaFX 17 (and configure as default in /etc/environment)
exec { 'download-openjfx17':
command => "wget https://download2.gluonhq.com/openjfx/${javafx_17_version}/openjfx-${javafx_17_version}_linux-x64_bin-sdk.zip -O /tmp/openjfx-${javafx_17_version}_linux-x64_bin-sdk.zip",
path => '/usr/bin',
user => 'root',
creates => "/usr/lib/jvm/javafx-sdk-${javafx_17_version}",
require => Package['wget'],
}
~> exec { 'extract-openjfx17':
command => "unzip /tmp/openjfx-${javafx_17_version}_linux-x64_bin-sdk.zip -d /usr/lib/jvm",
path => '/usr/bin',
user => 'root',
creates => "/usr/lib/jvm/javafx-sdk-${javafx_17_version}",
require => Package['unzip'],
}
~> file_line { '_JAVA_OPTIONS':
ensure => present,
path => '/etc/environment',
line => "_JAVA_OPTIONS=\"--module-path=/usr/lib/jvm/javafx-sdk-${javafx_17_version}/lib --add-modules=ALL-MODULE-PATH\"",
match => '^_JAVA_OPTIONS\=',
}
# Install Maven
exec { 'install-maven':
command => "curl -L https://archive.apache.org/dist/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz | tar zxv -C /opt",
path => '/usr/bin',
user => 'root',
creates => "/opt/apache-maven-${maven_version}",
require => Package['curl'],
}
file { '/opt/maven':
ensure => link,
target => "/opt/apache-maven-${maven_version}",
replace => false,
owner => 'root',
group => 'root',
require => Exec['install-maven'],
}
file_line { 'MAVEN_HOME':
ensure => present,
path => '/etc/environment',
line => 'MAVEN_HOME=/opt/maven',
match => '^MAVEN_HOME\=',
require => File['/opt/maven'],
}
file_line { 'PATH':
ensure => present,
path => '/etc/environment',
line => 'PATH=/opt/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin',
match => '^PATH\=',
require => File['/opt/maven'],
}