Skip to content

Commit fa80e20

Browse files
committed
Merge branch 'java-11'
2 parents a3ffbae + 0e41b03 commit fa80e20

File tree

2 files changed

+94
-23
lines changed

2 files changed

+94
-23
lines changed

Jenkinsfile

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,74 @@
1+
import java.util.regex.Matcher
2+
13
node {
24
catchError {
3-
def nexusRepo = 'https://www.silverpeas.org/nexus/content/repositories/snapshots/'
4-
docker.image('silverpeas/silverbuild')
5-
.inside('-u root -v $HOME/.m2/settings.xml:/root/.m2/settings.xml -v $HOME/.m2/settings-security.xml:/root/.m2/settings-security.xml -v $HOME/.gitconfig:/root/.gitconfig -v $HOME/.ssh:/root/.ssh -v $HOME/.gnupg:/root/.gnupg') {
5+
def version
6+
docker.image('silverpeas/silverbuild:java-11')
7+
.inside('-v $HOME/.m2:/home/silverbuild/.m2 -v $HOME/.gitconfig:/home/silverbuild/.gitconfig -v $HOME/.ssh:/home/silverbuild/.ssh -v $HOME/.gnupg:/home/silverbuild/.gnupg') {
68
stage('Preparation') {
79
checkout scm
10+
version = computeSnapshotVersion()
11+
sh """
12+
mvn -U versions:set -DgenerateBackupPoms=false -DnewVersion=${version}
13+
"""
814
}
9-
stage('Build and deployment') {
10-
sh "mvn clean deploy -DaltDeploymentRepository=silverpeas::default::${nexusRepo} -Djava.awt.headless=true"
15+
stage('Build') {
16+
def lockFilePath = createLockFile(version, 'testdep')
17+
def status = sh (returnStatus: true,
18+
script: "mvn clean install -Djava.awt.headless=true")
19+
deleteLockFile(lockFilePath)
20+
if (status != 0) {
21+
error "Build Failure"
22+
}
1123
}
1224
}
1325
}
1426
step([$class : 'Mailer',
1527
notifyEveryUnstableBuild: true,
1628
recipients : "miguel.moquillon@silverpeas.org, yohann.chastagnier@silverpeas.org, nicolas.eysseric@silverpeas.org",
1729
sendToIndividuals : true])
30+
}
31+
32+
def computeSnapshotVersion() {
33+
def pom = readMavenPom()
34+
final String version = pom.version
35+
final String release = pom.properties['next.release']
36+
final String defaultVersion = env.BRANCH_NAME == 'master' || env.BRANCH_NAME.endsWith('.x') ?
37+
version : release + '-' + env.BRANCH_NAME.toLowerCase().replaceAll('[# -]', '')
38+
Matcher m = env.CHANGE_TITLE =~ /^(Bug #?\d+|Feature #?\d+).*$/
39+
String snapshot = m.matches()
40+
? m.group(1).toLowerCase().replaceAll(' #?', '')
41+
: ''
42+
if (snapshot.isEmpty()) {
43+
m = env.CHANGE_TITLE =~ /^\[([^\[\]]+)].*$/
44+
snapshot = m.matches()
45+
? m.group(1).toLowerCase().replaceAll('[/><|:&?!;,*%$=}{#~\'"\\\\°)(\\[\\]]', '').trim().replaceAll('[ @]', '-')
46+
: ''
47+
}
48+
return snapshot.isEmpty() ? defaultVersion : "${release}-${snapshot}"
49+
}
50+
51+
static def createLockFilePath(version, projectName) {
52+
final String lockFilePath = "\$HOME/.m2/${version}_${projectName}_build.lock"
53+
return lockFilePath
54+
}
55+
56+
def createLockFile(version, projectName) {
57+
final String lockFilePath = createLockFilePath(version, projectName)
58+
sh "touch ${lockFilePath}"
59+
return lockFilePath
60+
}
61+
62+
def deleteLockFile(lockFilePath) {
63+
if (isLockFileExisting(lockFilePath)) {
64+
sh "rm -f ${lockFilePath}"
65+
}
66+
}
67+
68+
def isLockFileExisting(lockFilePath) {
69+
if (lockFilePath?.trim()?.length() > 0) {
70+
def exitCode = sh script: "test -e ${lockFilePath}", returnStatus: true
71+
return exitCode == 0
72+
}
73+
return false
1874
}

pom.xml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
</dependency>
100100
<dependency>
101101
<groupId>org.hamcrest</groupId>
102-
<artifactId>hamcrest-all</artifactId>
103-
<version>1.3</version>
102+
<artifactId>hamcrest</artifactId>
103+
<version>2.2</version>
104104
<scope>test</scope>
105105
</dependency>
106106
<dependency>
@@ -128,25 +128,41 @@
128128
<dependency>
129129
<groupId>org.awaitility</groupId>
130130
<artifactId>awaitility</artifactId>
131-
<version>3.1.2</version>
131+
<version>4.0.3</version>
132132
</dependency>
133133
<!-- TODO to be removed later in profit of DbSetup -->
134134
<dependency>
135135
<groupId>org.dbunit</groupId>
136136
<artifactId>dbunit</artifactId>
137-
<version>2.5.4</version>
137+
<version>2.7.0</version>
138138
<exclusions>
139+
<exclusion>
140+
<groupId>commons-collections</groupId>
141+
<artifactId>commons-collections</artifactId>
142+
</exclusion>
143+
<exclusion>
144+
<groupId>junit</groupId>
145+
<artifactId>junit</artifactId>
146+
</exclusion>
139147
<exclusion>
140148
<groupId>org.apache.poi</groupId>
141149
<artifactId>poi-ooxml</artifactId>
142150
</exclusion>
151+
<exclusion>
152+
<groupId>org.postgresql</groupId>
153+
<artifactId>postgresql</artifactId>
154+
</exclusion>
155+
<exclusion>
156+
<groupId>org.slf4j</groupId>
157+
<artifactId>slf4j-api</artifactId>
158+
</exclusion>
143159
</exclusions>
144160
</dependency>
145161
<!-- end TODO -->
146162
<dependency>
147163
<groupId>org.jboss.spec</groupId>
148-
<artifactId>jboss-javaee-all-7.0</artifactId>
149-
<version>1.1.1.Final</version>
164+
<artifactId>jboss-javaee-all-8.0</artifactId>
165+
<version>1.0.4.Final</version>
150166
<scope>test</scope>
151167
</dependency>
152168
<dependency>
@@ -176,7 +192,7 @@
176192
<dependency>
177193
<groupId>org.jboss.shrinkwrap.resolver</groupId>
178194
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
179-
<version>3.1.3</version>
195+
<version>3.1.4</version>
180196
<scope>test</scope>
181197
</dependency>
182198
<dependency>
@@ -211,7 +227,7 @@
211227
<dependency>
212228
<groupId>com.sleepycat</groupId>
213229
<artifactId>je</artifactId>
214-
<version>18.3.1</version>
230+
<version>18.3.12</version>
215231
<scope>test</scope>
216232
</dependency>
217233
<!-- LDAP test dependencies END -->
@@ -220,7 +236,7 @@
220236
<dependency>
221237
<groupId>com.icegreen</groupId>
222238
<artifactId>greenmail</artifactId>
223-
<version>1.5.8</version>
239+
<version>1.5.13</version>
224240
<scope>test</scope>
225241
</dependency>
226242

@@ -243,7 +259,7 @@
243259
<dependency>
244260
<groupId>commons-beanutils</groupId>
245261
<artifactId>commons-beanutils</artifactId>
246-
<version>1.9.3</version>
262+
<version>1.9.4</version>
247263
<scope>test</scope>
248264
</dependency>
249265
</dependencies>
@@ -252,16 +268,15 @@
252268
<properties>
253269
<!-- property used by the CI to both deploy a build version and release the next stable version -->
254270
<next.release>1.3</next.release>
255-
<maven.compiler.source>1.8</maven.compiler.source>
256-
<maven.compiler.target>1.8</maven.compiler.target>
271+
<maven.compiler.release>11</maven.compiler.release>
257272
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
258-
<junit.version>5.3.1</junit.version>
259-
<mokito.version>2.23.0</mokito.version>
260-
<weld-junit.version>1.3.1.Final</weld-junit.version>
273+
<junit.version>5.6.2</junit.version>
274+
<mokito.version>3.3.3</mokito.version>
275+
<weld-junit.version>2.0.1.Final</weld-junit.version>
261276
<dbsetup.version>2.1.0</dbsetup.version>
262-
<resteasy.version>3.6.1.Final</resteasy.version>
263-
<arquillian.version>1.4.0.Final</arquillian.version>
264-
<arquillian.wildfly.version>2.1.1.Final</arquillian.wildfly.version>
277+
<resteasy.version>3.11.2.Final</resteasy.version>
278+
<arquillian.version>1.6.0.Final</arquillian.version>
279+
<arquillian.wildfly.version>2.2.0.Final</arquillian.wildfly.version>
265280
</properties>
266281

267282
</project>

0 commit comments

Comments
 (0)