Skip to content

How to add Gradle Instructions to guides

Kin Ueng edited this page May 23, 2022 · 11 revisions

Background:

Right now, we only have support for Maven instructions in guides on openliberty.io. As part of issue https://github.com/OpenLiberty/openliberty.io/issues/1481, we are going to add support for building the guides using Gradle in addition to Maven. Guides will be updated one-by-one instead of all at once, so support for both the old format of guides and new format will be given.

Where to test changes (temporary):

Reach out to @OpenLiberty/openliberty-io-members when you to try this wiki. The team will need to provision a demo site containing the Gradle support work in openliberty.io.

Use the https://demo1-openlibertyio.mybluemix.net/ site to test gradle instructions initially and make a branch in the guide's repo named gradle. The demo1 site will clone the gradle branch.

To rebuild the demo1 pipeline:

git clone https://github.com/OpenLiberty/openliberty.io
cd openliberty.io
git checkout demo1
git commit -m --allow-empty "Trigger Build"
git push

Add gradle to the prereqs:

(let me know if there's a better way to specify this)

Add the guide permalink to the gradle prerequisite here: https://github.com/OpenLiberty/guides-common/blob/gradle/guide_prereqs.json. For now, make sure to add it to the gradle branch which is what demo1 will clone.

Example:

{
    "name": "Gradle",
    "link": "https://gradle.org/install",
    "guides": [
        ["gradle-intro", "kubernetes-intro"]
    ],
    "exclude": [
        "maven-intro"
    ]
}

The first guide to convert was referenced from this comment: https://github.com/OpenLiberty/openliberty.io/issues/1481#issuecomment-640844509

Maven and Gradle wrappers:

As part of the conversion to Gradle support, we need to add both the Maven wrapper and the Gradle wrapper in the guide repo on Github. This will remove the need for the user to have Maven or Gradle installed on their machine.

How to add maven/gradle tabs:

How to make the entire maven/gradle tab a hotspot when you click on the tabs:

[source, role="maven_section command hotspot"]
----
Run the integration tests against a cluster running with a host name of `localhost`:
mvnw failsafe:integration-test`
----

[source, role="gradle_section command hotspot file=0"]
----
Run the integration tests against a cluster running with a host name of `localhost`:

gradlew failsafe:integration-test
----

How to make a part of a maven/gradle tab a hotspot (normal hover behavior):

[role="maven_section command", subs="macros"]
----
Run the integration tests against a cluster running with a host name of `localhost`:


+++
<span class="hotspot">
mvnw failsafe:integration-test
</span>
+++
----

Notice the subs="macro" attribute is required and the triple '+' surrounding the hotspot.

Maven/gradle tabs nested within Operating System tabs:

[.tab_content.windows_section.mac_section]
--

[role="maven_section command", subs="macros"]
----
Run the integration tests against a cluster running with a host name of `localhost`:

+++
<span class="hotspot">
mvnw failsafe:integration-test
</span>
+++
----


[source, role="gradle_section command hotspot file=0"]
----
Run the integration tests against a cluster running with a host name of `localhost`:


gradlew failsafe:integration-test
----

--


[.tab_content.linux_section]
--
Run the integration tests with the IP address for Minikube:
[role='command']
----
`mvn failsafe:integration-test -Dsystem.service.root=$(minikube ip):31000 -Dinventory.service.root=$(minikube ip):32000
----
--

Example:

image