Skip to content

Commit f198e83

Browse files
authored
Merge pull request #358 from jmtd/OPENJDK-631-quarkus-fast-jar
[OPENJDK-631] support quarkus fast-jar build layout out-of-the-box
2 parents 3a24585 + c1252fa commit f198e83

File tree

5 files changed

+41
-6
lines changed

5 files changed

+41
-6
lines changed

modules/maven/s2i/module.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ description: ^
88
envs:
99
- name: MAVEN_S2I_ARTIFACT_DIRS
1010
description: >
11-
Relative paths of source directories to scan for build output, which will
12-
be copied to $DEPLOY_DIR. Defaults to **target**
11+
Relative paths of source directories to scan for build output,
12+
which will be copied to $S2I_TARGET_DEPLOYMENTS_DIR.
13+
Paths should be delimited by a comma (,).
14+
Defaults to **target**
1315
example: target
1416

1517
- name: MAVEN_S2I_GOALS

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ check_error() {
2222
fi
2323
}
2424

25+
# detect Quarkus fast-jar package type (OPENJDK-631)
26+
is_quarkus_fast_jar() {
27+
if test -f quarkus-app/quarkus-run.jar; then
28+
log_info "quarkus fast-jar package type detected"
29+
echo quarkus-app/quarkus-run.jar
30+
return 0
31+
else
32+
return 1
33+
fi
34+
}
35+
2536
# Try hard to find a sane default jar-file
2637
auto_detect_jar_file() {
2738
local dir=$1
@@ -30,6 +41,12 @@ auto_detect_jar_file() {
3041
local old_dir=$(pwd)
3142
cd ${dir}
3243
if [ $? = 0 ]; then
44+
45+
if quarkus="$(is_quarkus_fast_jar)"; then
46+
echo "$quarkus"
47+
return
48+
fi
49+
3350
local nr_jars=`ls *.jar 2>/dev/null | grep -v '^original-' | wc -l | tr -d '[[:space:]]'`
3451
if [ ${nr_jars} = 1 ]; then
3552
ls *.jar | grep -v '^original-'

modules/s2i/bash/module.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ description: Customization of common Maven S2I for Java S2I image.
66
envs:
77
- name: JBOSS_CONTAINER_JAVA_S2I_MODULE
88
value: /opt/jboss/container/java/s2i
9-
- name: S2I_SOURCE_DEPLOYMENTS_FILTER
10-
value: "*.jar"
119

1210
execute:
1311
- script: configure.sh

modules/s2i/core/module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ envs:
7878
- name: S2I_SOURCE_DEPLOYMENTS_FILTER
7979
description: >
8080
Space separated list of filters to be applied when copying deployments.
81-
Defaults to ** * **
82-
value: "*"
81+
Defaults to ** *.jar quarkus-app **
82+
value: "*.jar quarkus-app"
8383
example: "*.jar *.war *.ear"
8484

8585
- name: S2I_TARGET_DEPLOYMENTS_DIR

tests/features/java/openjdk_s2i.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@ Feature: Openshift OpenJDK-only S2I tests
1010
Scenario: Ensure Quarkus CDS doesn't fail due to timestamp mismatch (OPENDJK-1673)
1111
Given s2i build https://github.com/jerboaa/quarkus-quickstarts from getting-started using quickstart-2.16-s2i-cds
1212
Then container log should not contain A jar file is not the one used while building the shared archive file
13+
14+
Scenario: quarkus fast-jar layout works out-of-the-box (OPENJDK-631)
15+
Given s2i build https://github.com/jmtd/openshift-quickstarts from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i using OPENJDK-631-quarkus-fast-jar
16+
Then container log should contain INFO quarkus fast-jar package type detected
17+
And container log should contain -jar /deployments/quarkus-app/quarkus-run.jar
18+
And container log should contain (main) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus
19+
# these might occur if the wrong JAR is chosen as the main one
20+
And container log should not contain -jar /deployments/getting-started-1.0.0-SNAPSHOT.jar
21+
And container log should not contain no main manifest attribute
22+
23+
Scenario: quarkus uber-jar layout works out-of-the-box (OPENJDK-631)
24+
Given s2i build https://github.com/jmtd/openshift-quickstarts from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env using OPENJDK-631-quarkus-fast-jar
25+
| variable | value |
26+
| QUARKUS_PACKAGE_TYPE | uber-jar |
27+
Then container log should not contain INFO quarkus fast-jar package type detected
28+
And container log should not contain -jar /deployments/quarkus-app/quarkus-run.jar
29+
And container log should contain -jar /deployments/getting-started-1.0.0-SNAPSHOT-runner.jar
30+
And container log should contain (main) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus

0 commit comments

Comments
 (0)