Skip to content
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
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/finish"
schedule:
interval: monthly
open-pull-requests-limit: 50
- package-ecosystem: gradle
directory: "/finish/jar"
schedule:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,20 @@ jobs:
- name: Post tests
if: always()
run: |
sudo chmod -R +rx jar/build
sudo chmod -R +rx war/build
sudo chmod -R +rx ear/build
logsPath=$(sudo find . -name "console.log" | grep ear);
sudo cat "$logsPath" | sudo grep Launching
- name: Archive server logs if failed
if: failure()
uses: actions/upload-artifact@v4
with:
name: ear-logs
path: finish/ear/target/liberty/wlp/usr/servers/defaultServer/logs/
path: finish/ear/build/wlp/usr/servers/defaultServer/logs/
- name: Archive reports if failed
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports
path: finish/**/build/reports/
11 changes: 7 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ start/build.gradle
include::finish/build.gradle[]
----

Set the [hotspot=allprojects file=1]`basic configuration` for the project. Apply [hotspot=java file=1]`java` plugin and its [hotspot=options file=1]`options` to all sub-projects. The plugins and dependencies will be downloaded from the repositories that are specified in the [hotspot=repositories file=1]`repositories` configuration. Each child module inherits all the configurations.
Set the [hotspot=allprojects file=1]`basic configuration` for the project. Apply [hotspot=java file=1]`java` plugin, its [hotspot=options file=1]`options`, and [hotspot=junit file=1]`junit` dependencies to all sub-projects. The plugins and dependencies will be downloaded from the repositories that are specified in the [hotspot=repositories file=1]`repositories` configuration. Each child module inherits all the configurations.



Expand Down Expand Up @@ -354,10 +354,13 @@ BUILD SUCCESSFUL in 3s

> Task :ear:libertyDev
Tests finished.
To run tests on demand, press the Enter key.

----

You can find the test result of each module from their build directory:

* `jar/build/reports/tests/test/index.html`
* `ear/build/reports/tests/test/index.html`
* `war/build/reports/tests/test/index.html`

When you are done checking out the service, exit dev mode by pressing `CTRL+C` in the command-line session where you ran the Liberty.

Expand All @@ -367,7 +370,7 @@ When you are done checking out the service, exit dev mode by pressing `CTRL+C` i

== Building the multi-module application

You aggregated and developed the application. Now, you can run `./gradlew clean libertyPackage` once from the `start` directory and it will automatically build all your modules. This command creates a JAR file in the `jar/build` directory, a WAR file in the `war/build` directory, and an EAR file that contains the JAR and WAR files in the `ear/build` directory.
You aggregated and developed the application. Now, you can run `./gradlew clean libertyPackage` once from the `start` directory and it will automatically build all your modules. This command creates a JAR file in the `jar/build/libs` directory, a WAR file in the `war/build/libs` directory, and an EAR file that contains the WAR file in the `ear/build/libs` directory.

ifndef::cloud-hosted[]
Run the following command from the start directory to build the entire application:
Expand Down
13 changes: 13 additions & 0 deletions finish/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,23 @@ subprojects {
}
// end::options[]

// tag::junit[]
test {
useJUnitPlatform()
}

dependencies {
testImplementation platform('org.junit:junit-bom:5.12.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// end::junit[]

// tag::repositories[]
repositories {
mavenLocal()
mavenCentral()
}
// end::repositories[]

}
13 changes: 8 additions & 5 deletions finish/ear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies {
// tag::war[]
deploy project(path:':war', configuration:'archives')
// end::war[]
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
}

// tag::earConfig[]
Expand All @@ -53,19 +52,23 @@ liberty {
copyLibsDirectory = file("${project.getLayout().getBuildDirectory().getAsFile().get()}/libs")
// end::copyLibsDirectory[]
}
var.'http.port' = '9080'
var.'https.port' = '9443'
verifyAppStartTimeout = 30
looseApplication = true
}
}
// end::libertyConfig[]

// tag::test[]
test {
systemProperty 'http.port', liberty.server.var.'http.port'
}
// end::test[]

// tag::deployDependsOn[]
deploy.dependsOn 'ear'
// end::deployDependsOn[]
// tag::earDependsOn[]
ear.dependsOn ':jar:jar', ':war:war'
// end::earDependsOn[]

test{
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.junit.jupiter.api.Test;

public class IT {
String port = "9080";
String port = System.getProperty("http.port");
String war = "converter";
String urlBase = "http://localhost:" + port + "/" + war + "/";

Expand Down
12 changes: 0 additions & 12 deletions finish/jar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ apply plugin: 'java'

description = 'JAR Module'

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
}

test{
useJUnitPlatform()
}

jar {
archiveFileName = rootProject.name + '-' + getArchiveBaseName().get() + '-' +
rootProject.version + '.' + getArchiveExtension().get()
Expand Down
5 changes: 0 additions & 5 deletions finish/war/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ dependencies {
// tag::projectJar[]
implementation project(':jar')
// end::projectJar[]
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
compileOnly 'jakarta.platform:jakarta.jakartaee-api:10.0.0'
compileOnly 'org.eclipse.microprofile:microprofile:7.0'
}

test {
useJUnitPlatform()
}

war {
archiveFileName = rootProject.name + '-' + getArchiveBaseName().get() + '-' +
rootProject.version + '.' + getArchiveExtension().get()
Expand Down
2 changes: 1 addition & 1 deletion finish/war/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<h3>Enter the height in centimeter</h3>

<form action="heights.jsp" method="post">
<input type="text" name="heightCm" /> cm <br> <input type="submit"
<input type="text" name="heightCm" /> cm <p/> <input type="submit"
value="CHECK" />
</form>

Expand Down
17 changes: 17 additions & 0 deletions scripts/testApp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ cat ./build.gradle
./gradlew libertyStart
sleep 5
curl http://localhost:9080/converter/ | grep "Height Converters"
./gradlew ear:test
./gradlew libertyStop

./gradlew jar:test
./gradlew war:test

if [ ! -f "jar/build/libs/guide-gradle-multimodules-jar-1.0-SNAPSHOT.jar" ]; then
echo "jar/build/libs/guide-gradle-multimodules-jar-1.0-SNAPSHOT.jar was not generated!"
exit 1
fi

if [ ! -f "war/build/libs/guide-gradle-multimodules-war-1.0-SNAPSHOT.war" ]; then
echo "war/build/libs/guide-gradle-multimodules-war-1.0-SNAPSHOT.war was not generated!"
exit 1
fi

if [ ! -f "ear/build/libs/guide-gradle-multimodules-ear-1.0-SNAPSHOT.ear" ]; then
echo "ear/build/libs/guide-gradle-multimodules-ear-1.0-SNAPSHOT.ear was not generated!"
exit 1
fi
18 changes: 0 additions & 18 deletions start/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
allprojects {
group = 'io.openliberty.guides'
version = '1.0-SNAPSHOT'
}

subprojects {
apply plugin: 'java'

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release.set(11)
}

repositories {
mavenLocal()
mavenCentral()
}
}
4 changes: 0 additions & 4 deletions start/ear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ buildscript {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.9.2'
}
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
}
11 changes: 0 additions & 11 deletions start/jar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ apply plugin: 'java'

description = 'JAR Module'

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
}

test{
useJUnitPlatform()
}

jar {
archiveFileName = rootProject.name + '-' + getArchiveBaseName().get() + '-' +
rootProject.version + '.' + getArchiveExtension().get()
Expand Down
5 changes: 0 additions & 5 deletions start/war/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@ apply plugin: 'war'
description = 'WAR Module'

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
compileOnly 'jakarta.platform:jakarta.jakartaee-api:10.0.0'
compileOnly 'org.eclipse.microprofile:microprofile:7.0'
}

test {
useJUnitPlatform()
}

war {
archiveFileName = rootProject.name + '-' + getArchiveBaseName().get() + '-' +
rootProject.version + '.' + getArchiveExtension().get()
Expand Down
2 changes: 1 addition & 1 deletion start/war/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<h3>Enter the height in centimeter</h3>

<form action="heights.jsp" method="post">
<input type="text" name="heightCm" /> cm <br> <input type="submit"
<input type="text" name="heightCm" /> cm <p/> <input type="submit"
value="CHECK" />
</form>

Expand Down
Loading