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
51 changes: 39 additions & 12 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ ear/build.gradle
include::finish/ear/build.gradle[]
----

Define the [hotspot=ear file=0]`ear` and [hotspot=liberty file=0]`liberty` plug-ins that you want to use. Configure the [hotspot=earConfig file=0]`ear` task with the deployment descriptor that provides the web module file name and the context root as [hotspot=webModule file=0]`/converter`. Configure the [hotspot=libertyConfig file=0]`liberty` task that creates the Liberty server name as [hotspot=sampleLibertyServer file=0]`sampleLibertyServer` and deploys the ear file from the path specified by the [hotspot=copyLibsDirectory file=0]`copyLibsDirectory` variable.
Define the [hotspot=ear file=0]`ear` and [hotspot=liberty file=0]`liberty` plug-ins that you want to use. Configure the [hotspot=earConfig file=0]`ear` task with the deployment descriptor that provides the web module file name and the context root as [hotspot=webModule file=0]`/converter`.

The [hotspot=war file=0]`war` project is added as a project dependency. The [hotspot=deployDependsOn file=0]`deploy` task depends on the `ear` task and the [hotspot=earDependsOn file=0]`ear` task depends on the `jar` task from the `jar` project and the `war` task from the `war` project.
If no context path is specified, Gradle automatically uses the WAR file artifact ID as the context root for the application while generating the `application.xml` file. The default artifact ID is `{pojectName}-{moduleName}-{version}`. For this guide, it is `guide-gradle-multimodules-war-1.0-SNAPSHOT`.

Configure the [hotspot=libertyConfig file=0]`liberty` task that creates the Liberty server name as [hotspot=sampleLibertyServer file=0]`sampleLibertyServer` and deploys the ear file from the path specified by the [hotspot=copyLibsDirectory file=0]`copyLibsDirectory` variable.

If no context path is specified, Gradle automatically uses the WAR file artifactId ID as the context root for the application while generating the `application.xml` file.
The [hotspot=war file=0]`war` project is added as a project dependency. The [hotspot=deployDependsOn file=0]`deploy` task depends on the `ear` task and the [hotspot=earDependsOn file=0]`ear` task depends on the `jar` task from the `jar` project and the `war` task from the `war` project.

To deploy and run an EAR application on an Open Liberty instance, you need to provide a Liberty's `server.xml` configuration file.

Expand Down Expand Up @@ -319,15 +321,40 @@ You will see the following output:

[source, role="no_copy"]
----
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running it.io.openliberty.guides.multimodules.IT
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.712 sec - in it.io.openliberty.guides.multimodules.IT

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
Running tests...

> Task :ear:cleanTest
> Task :jar:cleanTest
> Task :war:cleanTest
> Task :ear:compileJava NO-SOURCE
> Task :ear:processResources NO-SOURCE
> Task :ear:classes UP-TO-DATE
> Task :ear:compileTestJava UP-TO-DATE
> Task :ear:processTestResources NO-SOURCE
> Task :ear:testClasses UP-TO-DATE
> Task :ear:test
> Task :jar:compileJava UP-TO-DATE
> Task :jar:processResources NO-SOURCE
> Task :jar:classes UP-TO-DATE
> Task :jar:jar UP-TO-DATE
> Task :jar:compileTestJava UP-TO-DATE
> Task :jar:processTestResources NO-SOURCE
> Task :jar:testClasses UP-TO-DATE
> Task :jar:test
> Task :war:compileJava UP-TO-DATE
> Task :war:processResources NO-SOURCE
> Task :war:classes UP-TO-DATE
> Task :war:compileTestJava UP-TO-DATE
> Task :war:processTestResources NO-SOURCE
> Task :war:testClasses UP-TO-DATE
> Task :war:test

BUILD SUCCESSFUL in 3s
12 actionable tasks: 6 executed, 6 up-to-date

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

----

Expand Down
4 changes: 4 additions & 0 deletions finish/ear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ deploy.dependsOn 'ear'
// 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 = System.getProperty("http.port");
String port = "9080";
String war = "converter";
String urlBase = "http://localhost:" + port + "/" + war + "/";

Expand All @@ -32,7 +32,7 @@ public void testIndexPage() throws Exception {
String url = this.urlBase;
HttpURLConnection con = testRequestHelper(url, "GET");
assertEquals(200, con.getResponseCode(), "Incorrect response code from " + url);
assertTrue(testBufferHelper(con).contains("Enter the height in centimeters"),
assertTrue(testBufferHelper(con).contains("Enter the height in centimeter"),
"Incorrect response from " + url);
}
// end::testIndexPage[]
Expand Down
Loading