diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..66ad403 --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..7d60fd7 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,109 @@ +name: Build + +on: + push: + branches: ["cicsts/v5.5"] + pull_request: + branches: ["cicsts/v5.5"] + schedule: + - cron: '0 0 * * *' + +permissions: + contents: read + +jobs: + check-copyright: + runs-on: ubuntu-latest + name: Check Copyright + if: ${{ !startsWith(github.head_ref, 'create-pull-request/') }} + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - id: copyright-action + uses: cicsdev/.github/.github/actions/samples-copyright-checker@4134522d8109169bb8c460db841f94167ec2802f + with: + directory: './cics-java-liberty-jdbc-app/' + file-extensions: '*.js *.java *.html' + base-copyright: 'Copyright IBM Corp. 2025' + token: ${{ secrets.GITHUB_TOKEN }} + + build-maven: + name: Build Maven + + runs-on: ubuntu-latest + strategy: + matrix: + # JDK 8 excluded: maven-compiler-plugin requires JDK 9+ + # Use JDK 11+ with -Djava.version=8 to validate Java 8 source compatibility + jdk: [11, 17, 21, 25] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.jdk }} + distribution: "semeru" + cache: maven + - name: Build with Maven + run: mvn --batch-mode --update-snapshots --file pom.xml -Djava.version=8 verify + + build-mvnw: + name: Build Maven Wrapper + + runs-on: ubuntu-latest + strategy: + matrix: + # JDK 8 excluded: maven-compiler-plugin requires JDK 9+ + # Use JDK 11+ with -Djava.version=8 to validate Java 8 source compatibility + jdk: [11, 17, 21, 25] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.jdk }} + distribution: "semeru" + - name: Build with Maven Wrapper + run: ./mvnw --batch-mode --update-snapshots --file pom.xml -Djava.version=8 verify + + build-gradle: + name: Build Gradle + + runs-on: ubuntu-latest + strategy: + matrix: + jdk: [8, 11, 17, 21, 25] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.jdk }} + distribution: 'semeru' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: 8.14.4 + - name: Build with Gradle + run: gradle clean build -Pjava_version=${{ matrix.jdk }} + + build-gradlew: + name: Build Gradle Wrapper + + runs-on: ubuntu-latest + strategy: + matrix: + jdk: [8, 11, 17, 21, 25] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.jdk }} + distribution: 'semeru' + - name: Build with Gradle Wrapper + run: ./gradlew clean build -Pjava_version=${{ matrix.jdk }} diff --git a/.github/workflows/cleanup-old-runs.yaml b/.github/workflows/cleanup-old-runs.yaml new file mode 100644 index 0000000..c9e3702 --- /dev/null +++ b/.github/workflows/cleanup-old-runs.yaml @@ -0,0 +1,23 @@ +name: Cleanup old workflow runs + +on: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +permissions: + contents: read + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - name: Delete old workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 30 + keep_minimum_runs: 6 diff --git a/.github/workflows/java.yaml b/.github/workflows/java.yaml deleted file mode 100644 index da2d7f0..0000000 --- a/.github/workflows/java.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build - -on: - push: - branches: ["cicsts/v5.5"] - pull_request: - branches: ["cicsts/v5.5"] - schedule: - - cron: '0 0 * * *' - -jobs: - check-copyright: - runs-on: ubuntu-latest - name: Check Copyright - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - id: copyright-action - uses: cicsdev/.github/.github/actions/samples-copyright-checker@4134522d8109169bb8c460db841f94167ec2802f - with: - directory: './cics-java-liberty-jdbc-web/' - file-extensions: '*.js *.java *.html' - base-copyright: 'Copyright IBM Corp. 2025' - token: ${{ secrets.GITHUB_TOKEN }} - - build-mvnw: - name: Build Maven Wrapper - - runs-on: ubuntu-latest - strategy: - matrix: - jdk: [8, 11, 17, 21] - steps: - - uses: actions/checkout@v3 - - name: Set up JDK ${{ matrix.jdk }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.jdk }} - distribution: "semeru" - cache: maven - - name: Build with Maven - run: ./mvnw --batch-mode --update-snapshots --file pom.xml -Djava.version=${{ matrix.jdk }} verify - - - build-gradlew: - name: Build Gradle Wrapper - - runs-on: ubuntu-latest - strategy: - matrix: - jdk: [8, 11, 17, 21] - steps: - - uses: actions/checkout@v3 - - name: Set up JDK ${{ matrix.jdk }} - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.jdk }} - distribution: 'semeru' - - uses: gradle/actions/setup-gradle@v3 - with: - gradle-version: 8.6 - - name: Build with Gradle - run: ./gradlew clean build -Pjava_version=${{ matrix.jdk }} diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 642d572..8dea6c2 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,3 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs index b8c0199..e889521 100644 --- a/.settings/org.eclipse.buildship.core.prefs +++ b/.settings/org.eclipse.buildship.core.prefs @@ -1,13 +1,2 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir=cics-java-liberty-jdbc-web +connection.project.dir= eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index a361f77..1d3fc37 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,15 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 \ No newline at end of file +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..1458b9e --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @cicsdev/cics-java-samples diff --git a/MAINTAINERS.md b/MAINTAINERS.md deleted file mode 100644 index ecc6ae6..0000000 --- a/MAINTAINERS.md +++ /dev/null @@ -1,8 +0,0 @@ -# Maintainers - -- Ivan D. Hargreaves [@IvanHargreaves](https://github.com/IvanHargreaves) -- Alex Brown [@AlexBrown](https://github.com/SoftlySplinter) -- Phil Wakelin [@PhilWakelin](https://github.com/PhilWakelin) -- Aaron Jhaj [@AaronJhaj](https://github.com/AaronJhaj) - -*Last reviewed:* June 2025 diff --git a/README.md b/README.md index bcd2dde..80604eb 100644 --- a/README.md +++ b/README.md @@ -1,215 +1,249 @@ # cics-java-liberty-jdbc -This sample demonstrates how to code, build, and deploy a CICS Java application that makes JDBC calls to Db2 from a web servlet in CICS Liberty. It makes use of the employee sample table supplied with Db2 for z/OS, and allows you to display employee information from the table EMP. +[![Build](https://github.com/cicsdev/cics-java-liberty-jdbc/actions/workflows/build.yaml/badge.svg?branch=cicsts/v5.5)](https://github.com/cicsdev/cics-java-liberty-jdbc/actions/workflows/build.yaml) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://www.apache.org/licenses/LICENSE-2.0) -## Contents -This is a set of sample Java projects for database interaction in CICS Java, demonstrating how you can use JDBC in a WAR in a Liberty JVM server, to allow it query items in Db2. +## Overview -This sample can use either Db2 type 2 or type 4 connectivity. +This sample demonstrates how to code, build, and deploy a CICS Java application that makes JDBC calls to Db2 from a web servlet running in a CICS Liberty JVM server. It uses the employee sample table (`EMP`) supplied with Db2 for z/OS, and allows you to display and query employee information. -* [`cics-java-liberty-jdbc-web`](cics-java-liberty-jdbc-web) - Dynamic web project containing the Java source. -* [`java-java-liberty-jdbc-bundle`](cics-java-liberty-jdbc-bundle) - CICS bundle plug-in based project, contains Web application bundle-parts. Use with Gradle and Maven builds. -* [`etc/config/liberty`](etc/config/liberty) - Liberty server configuration files -* [`etc/eclipse_projects/com.ibm.cics.server.examples.wlp.jdbc.bundle`](etc/eclipse_projects/com.ibm.cics.server.examples.wlp.jdbc.bundle) - CICS bundle project (CICS Explorer based CICS bundle project, contains Web application bundle-parts. Use with CICS Explorer 'Export to zFS' deployment capability.) +The sample uses the Java EE 7 Servlet API and is targeted for deployment in a CICS TS V5.5 Liberty JVM server. It supports both Db2 type 2 and type 4 connectivity. -## Requirements -* CICS TS V5.5 or later -* A connected CICS DB2CONN resource. For more information, see [CONFIGURING](#configuring) -* A Liberty JVM server -* Java SE 1.8 or later on the workstation -* IBM Db2 V13 or later on z/OS +**Key Features:** +- Demonstrates JDBC connectivity to Db2 for z/OS from a Liberty JVM server +- Supports both Db2 type 2 (local) and type 4 (network) JDBC drivers +- Provides a REST-style servlet that queries the Db2 `EMP` sample table +- Includes a simple HTML front-end for browsing employee records -## Downloading +## Table of Contents + +1. [Overview](#overview) +2. [Prerequisites](#prerequisites) +3. [Reference](#reference) +4. [Downloading](#downloading) +5. [Building the Sample](#building-the-sample) +6. [Deploying to a CICS Liberty JVM server](#deploying-to-a-cics-liberty-jvm-server) +7. [Running the Sample](#running-the-sample) +8. [Additional Resources](#additional-resources) +9. [License](#license) +10. [Contributing](#contributing) -- Clone the repository using your IDEs support, such as the Eclipse Git plugin -- **or**, download the sample as a [ZIP](https://github.com/cicsdev/cics-java-liberty-jdbc/archive/cicsts/v5.5.zip) and unzip onto the workstation +## Prerequisites -> [!TIP] -> Eclipse Git provides an 'Import existing Projects' check-box when cloning a repository. +- CICS TS V5.5 or later +- A configured Liberty JVM server in CICS +- Java SE 8 or later on the workstation +- Eclipse with the IBM CICS SDK for Java EE, Jakarta EE and Liberty (optional) +- Gradle or Apache Maven on the workstation (optional — wrappers are supplied) +- IBM Db2 V13 or later on z/OS with the `EMP` sample table +- A connected CICS `DB2CONN` resource (see [Deploying to a CICS Liberty JVM server](#deploying-to-a-cics-liberty-jvm-server)) -## Building +## Reference -You can build the sample in a variety of ways: -- Using the implicit compile/build of the Eclipse based CICS Explorer SDK -- Using the built-in Gradle or Maven support of your IDE (For example: *buildship* or *m2e* in Eclipse which integrate with the "Run As..." menu.) -- Using the supplied Gradle or Maven Wrapper scripts (no requirement for an IDE or Gradle/Maven install) -- or you can build it from the command line if you have Gradle or Maven installed on your workstation - +- Sample SQLJ Git repository: [cics-java-liberty-sqlj](https://github.com/cicsdev/cics-java-liberty-sqlj) +- CICS Knowledge Center: [Configuring a Liberty JVM server](https://www.ibm.com/docs/en/cics-ts/latest?topic=server-configuring-liberty-jvm) +- CICS Knowledge Center: [Configuring a JVM server to support Db2](https://www.ibm.com/docs/en/cics-ts/latest?topic=programs-configuring-jvm-server-support-db2) -> [!IMPORTANT] -> The sample comes pre-configured for use with a JDK 8 and CICS TS V5.5 Libraries for Java EE 8. When you initially import the project to your IDE, if your IDE is not configured for a JDK 8, or does not have CICS Explorer SDK installed, you might experience local project compile errors. To resolve issues you should configure the Project's build-path to add/remove your preferred combination of CICS TS, JDK, and Liberty's Enterprise Java libraries (Java EE or Jakarta EE). Resolving errors might also depend on how you wish to build and deploy the sample. If you are building and deploying through CICS Explorer SDK and 'Export to zFS' you should edit the link-app's Project properties. Select 'Java Build Path', on the Libraries tab select 'Classpath', click 'Add Library', select 'CICS with Enterprise Java and Liberty' Library, and choose the appropriate CICS and Enterprise Java versions. -If you are building and deploying with Gradle or Maven then you don't necessarily need to fix the local errors, but to do so, you can do as above, or you can run a tooling refresh on the jdbc-web project. For example, in Eclipse: right-click on "Project", select "Gradle -> Refresh Gradle Project", **or** right-click on "Project", select "Maven -> Update Project...". +## Downloading + +**If using Eclipse:** the simplest approach is to clone the repository using the Eclipse Git plugin (EGit) perspective. + +**If using the command line:** +```shell +git clone https://github.com/cicsdev/cics-java-liberty-jdbc +``` +Alternatively, download the sample as a [ZIP](https://github.com/cicsdev/cics-java-liberty-jdbc/archive/main.zip) and unzip onto the workstation. -> [!TIP] -> In Eclipse, Gradle (buildship) is able to fully refresh and resolve the local classpath even if the project was previously updated by Maven. However, Maven (m2e) does not currently reciprocate that capability. If you previously refreshed the project with Gradle, you'll need to manually remove the 'Project Dependencies' entry on the Java build-path of your Project Properties to avoid duplication errors when performing a Maven Project Update. +**If importing into Eclipse:** +1. In the **Git Repositories** view, right-click the repository → **Import as Project** + *(if you cloned from the command line, use **File → Import → Existing Projects into Workspace** instead, browse to the cloned directory, select all projects)* +2. Switch to the **Java EE** perspective +3. In the **Project Explorer**, right-click the `cics-java-liberty-jdbc-app` folder → **Import as Project** +4. Right-click the `cics-java-liberty-jdbc-cicsbundle` folder → **Import as Project** +5. Right-click the `cics-java-liberty-jdbc-cicsbundle-eclipse` folder → **Import as Project** +6. **Required:** Right-click the root project → **Gradle → Refresh Gradle Project** or **Maven → Update Project...** — this resolves CICS and framework dependencies into the project classpath. +**Package `com.ibm.cicsdev.liberty.jdbc`** +- [`DatabaseService`](cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseService.java) — obtains a JDBC connection and runs a timestamp query +- [`DatabaseServlet`](cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseServlet.java) — servlet that returns the current Db2 timestamp -### Option 1: Building with Eclipse +**Package `com.ibm.cicsdev.liberty.jdbc.employee`** +- [`Employee`](cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/Employee.java) — model class for an employee record +- [`EmployeeService`](cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeService.java) — queries the `EMP` table via JDBC +- [`EmployeeServlet`](cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeServlet.java) — servlet that returns employee data as JSON -If you are using the Egit client to clone the repo, remember to tick the button to import all projects. Otherwise, you should manually Import the projects into CICS Explorer using File → Import → General → Existing projects into workspace, then follow the error resolution advice above. +**Supporting files:** +- [`etc/config/liberty/server.xml`](etc/config/liberty/server.xml) — Liberty server template +- [`etc/config/jvmprofile/DFHWLP.jvmprofile`](etc/config/jvmprofile/DFHWLP.jvmprofile) — JVM profile template -### Option 2: Building with Gradle +## Building the Sample -For a complete build you should run the settings.gradle file in the top-level 'cics-java-liberty-jdbc' directory which is designed to invoke the individual build.gradle files for each project. +You can build the sample using an IDE of your choice, or from the command line. Using the supplied Gradle or Maven wrapper is the recommended approach to get a consistent build tool version. -If successful, a WAR file is created inside the `cics-java-liberty-jdbc-web/build/libs` directory and a CICS bundle ZIP file inside the `cics-java-liberty-jdbc-bundle/build/distribution` directory. +The required build tasks are `clean build` for Gradle and `clean verify` for Maven. Gradle generates a WAR file in `cics-java-liberty-jdbc-app/build/libs`; Maven generates it in `cics-java-liberty-jdbc-app/target`. -[!NOTE] -In Eclipse, the output 'build' directory is often hidden by default. From the Package Explorer pane, select the three dot menu, choose filters and un-check the Gradle build folder to view its contents. +### Gradle Wrapper (command line) -The JVM server the CICS bundle is targeted at is controlled through the `cics.jvmserver` property, defined in the [`cics-java-liberty-jdbc-bundle/build.gradle`](cics-java-liberty-jdbc-bundle/build.gradle) file, or alternatively can be set on the command line: +On Linux or Mac: -**Gradle Wrapper (Linux/Mac):** ```shell ./gradlew clean build ``` -**Gradle Wrapper (Windows):** -```shell -gradle.bat clean build -``` -**Gradle (command-line):** -```shell -gradle clean build -``` -**Gradle (command-line & setting jvmserver):** + +On Windows: + ```shell -gradle clean build -Pcics.jvmserver=MYJVM +gradlew.bat clean build ``` -### Option 3: Building with Apache Maven +This creates a WAR file inside the `cics-java-liberty-jdbc-app/build/libs` directory. -For a complete build you should run the pom.xml file in the top-level 'cics-java-liberty-jdbc' directory. A WAR file is created inside the `cics-java-liberty-jdbc-web/target` directory and a CICS bundle ZIP file inside the `cics-java-liberty-jdbc-bundle/target` directory. +> **Note:** In Eclipse, the `build` directory may be hidden by default. To view it: **Package Explorer → ⋮ → Filters and Customization → uncheck "Gradle build folder"**. -If building a CICS bundle ZIP the CICS JVM server name for the WAR bundle part should be modified in the - `cics.jvmserver` property, defined in [`cics-java-liberty-jdbc-bundle/pom.xml`](cics-java-liberty-jdbc-bundle/pom.xml) file under the `defaultjvmserver` configuration property, or alternatively can be set on the command line. +### Maven Wrapper (command line) + +On Linux or Mac: -**Maven Wrapper (Linux/Mac):** ```shell ./mvnw clean verify ``` -**Maven Wrapper (Windows):** + +On Windows: + ```shell mvnw.cmd clean verify ``` -**Maven (command-line):** -```shell -mvn clean verify -``` -**Maven (command-line & setting jvmserver):** -```shell -mvn clean verify -Dcics.jvmserver=MYJVM -``` -## Configuring +This creates a WAR file inside the `cics-java-liberty-jdbc-app/target` directory. -### Configure CICS for Db2 -To allow your CICS region to connect to DB2, we need to add some configuration to the JCL. +### Building with Eclipse (IDE) -``` -// SET DB2=V13 - DB2 Version -... - -... -DB2CONN=YES - -//STEPLIB -... -// DD DISP=SHR,DSN=SYS2.DB2.&DB2..SDSNLOAD -// DD DISP=SHR,DSN=SYS2.DB2.&DB2..SDSNLOD2 -``` +Once imported (see [Downloading](#downloading)), use the IDE's built-in Gradle or Maven integration: -### Configure the Liberty with DB2 -This sample uses the [EMP table](https://www.ibm.com/docs/en/db2-for-zos/latest?topic=tables-employee-table-dsn8d10emp) provided with the [Db2 sample tables](https://www.ibm.com/docs/en/db2-for-zos/latest?topic=zos-db2-sample-tables). -Configure the JVM profile of the Liberty JVM server to include the Db2 driver location. -> [!TIP] -> There are several options to configuring the database schema. The following config defines the schema in the JVM profile, however, the schema can be defined directly in the datasource in the server.xml in the datasource properties element. Or it can be defined in the application code itself once setting a connection. +**With Gradle (Buildship):** +1. Right-click the root project → **Run As → Gradle Build...** +2. Enter `clean build` in the Gradle Tasks field → **Run** +3. After the build completes, right-click the root project → **Gradle → Refresh Gradle Project** -> Note: The name of your JVM profile is assumed to be 'DFHWLP' +**With Maven (m2e):** +1. Right-click the root project → **Maven → Update Project...** → check **Force Update of Snapshots/Releases** → **OK** +2. Right-click the root project → **Run As → Maven build...** → enter `clean verify` → **Run** + +## Deploying to a CICS Liberty JVM server + +### Configure CICS for Db2 + +Configure the JVM profile of the Liberty JVM server to include the Db2 driver location: ``` -Dcom.ibm.cics.jvmserver.wlp.jdbc.driver.location=/usr/lpp/db2v13/jdbc -Ddb2.jcc.override.currentSchema=DBADMIN ``` -> Note: This example is using db2v13, this version must be consistent to the version set in your JCL. -As an example, see the provided [JVM profile template](etc/config/jvmprofile/DFHWLP.jvmprofile). If necessary, restart the JVM server. +See the provided [JVM profile template](etc/config/jvmprofile/DFHWLP.jvmprofile). Restart the JVM server after changes. + +Ensure the following feature is defined in your Liberty `server.xml`: -Ensure you have the following feature defined in your Liberty server.xml: -* `jdbc-4.1` +```xml + + cicsts:core-1.0 + servlet-3.1 + jdbc-4.1 + +``` -A template server.xml is provided [here](./etc/config/liberty/server.xml). +A template `server.xml` is provided [here](./etc/config/liberty/server.xml). -### Option 1 - Configure the DB2CONN with CEDA at a terminal +### Install a CICS DB2CONN resource -Ensure a CICS DB2CONN is installed and connected. +Ensure a CICS `DB2CONN` is installed and connected: ``` CEDA DEFINE DB2CONN(JODBCONN) GROUP(CDEVJLDB) -``` -``` CEDA INSTALL DB2CONN(JODBCONN) GROUP(CDEVJLDB) ``` -### Option 2 - Configure the DB2CONN with CICS Explorer -1. Definitions > Db2 > Db2 Connection Definitions -2. Right-click > New... -3. Fill in the Name and Group with `CDEVJLDB` -4. Right-click and install the new definition -5. Ensure it is CONNECTED - -> Note: The DB2ID differs between DB2 versions and the system you are running your CICS region on. Consult your CICS system programmer if you are unsure. - +### CICS Bundle Plugin Deployment (Gradle/Maven) ---- +**Configure your JVM server name** (default is `DFHWLP`): -## Deploying to CICS +Gradle: +```shell +./gradlew clean build "-Pcics.jvmserver=MYJVM" +``` -### Option 1 - Deploying using CICS Explorer SDK and the provided CICS bundle project -1. Deploy the CICS bundle project 'com.ibm.cics.server.examples.wlp.jdbc.bundle' from CICS Explorer using the **Export Bundle Project to z/OS UNIX File System** wizard. This CICS bundle includes the WAR bundlepart to run the sample. +Maven: +```shell +./mvnw clean verify "-Dcics.jvmserver=MYJVM" +``` +**Deploy the bundle:** -### Option 2 - Deploying using CICS Explorer SDK with own CICS bundle project -1. Copy and paste the built WAR from your *projects/cics-java-liberty-jdbc-web/target* or *projects/cics-java-liberty-jdbc-web/build/libs* directory into a new Eclipse CICS bundle project. -2. Create a new bundlepart that references the WAR file. -3. Optionally customise the CICS bundle contents, perhaps adding a TRANDEF of your choice -4. Right click using the ** Export Bundle Project to z/OS UNIX File System ** wizard. +1. Upload the CICS bundle ZIP to zFS: + - Gradle: `cics-java-liberty-jdbc-cicsbundle/build/distributions/` + - Maven: `cics-java-liberty-jdbc-cicsbundle/target/` +2. On z/OS, extract the bundle: + ```shell + jar xf cics-java-liberty-jdbc-cicsbundle.zip + ``` +3. Create and install a CICS BUNDLE resource definition pointing to the extracted directory: + ``` + CEDA DEFINE BUNDLE(JDBCBNDL) GROUP(CDEVJLDB) BUNDLEDIR(/path/to/bundle) + CEDA INSTALL BUNDLE(JDBCBNDL) GROUP(CDEVJLDB) + ``` +### CICS Explorer SDK Deployment -### Option 3 - Deploying using CICS Explorer (Remote System Explorer) and CICS Bundle ZIP -1. Connect to USS on the host system -2. Create the bundle directory for the project. -3. Copy & paste the built CICS bundle ZIP file from your *projects/cics-java-liberty-jdbc-bundle/target* or *projects/cics-java-liberty-jdbc-bundle/build/distributions* directory to z/FS on the host system into the bundle directory. -4. Extract the ZIP by right-clicking on the ZIP file > User Action > unjar... -5. Refresh the bundle directory +This repository includes a pre-configured Eclipse CICS bundle project `cics-java-liberty-jdbc-cicsbundle-eclipse`. +1. Right-click `cics-java-liberty-jdbc-cicsbundle-eclipse` → **Export Bundle Project to z/OS UNIX File System** and follow the wizard. -### Option 4 - Deploying using command line tools -1. Upload the built CICS bundle ZIP file from your *projects/cics-java-liberty-jdbc-bundle/target* or *projects/cics-java-liberty-jdbc-bundle/build/distributions* directory to z/FS on the host system (e.g. FTP). -2. Connect to USS on the host system (e.g. SSH). -3. Create the bundle directory for the project. -4. Move the CICS bundle ZIP file into the bundle directory. -5. Change directory into the bundle directoy. -6. Extract the CICS bundle ZIP file. This can be done using the `jar` command. For example: - ```shell - jar xf file.zip - ``` +### Direct Liberty Application Deployment ---- +1. Build the WAR using Gradle or Maven (see [Building the Sample](#building-the-sample)) +2. Upload the WAR file to zFS +3. Add an `` element to your Liberty `server.xml`: -## Running the sample -The servlet is accessed with the following URL: [http://zos.example.com:9080/cics-java-liberty-jdbc-web/database](http://zos.example.com:9080/cics-java-liberty-jdbc-web/database). +```xml + + + + + + + +``` -If the test is successful, you will see a response similar to the following written to the browser: +## Running the Sample -`Db2 current timestamp: 2024-01-01 09:30:00.000000.` +1. Verify the application started successfully in Liberty by checking for `CWWKT0016I` in `messages.log`: + ``` + CWWKT0016I: Web application available (default_host): http://hostname:9080/cics-java-liberty-jdbc/ + ``` +2. Test basic Db2 connectivity at: + `http://hostname:9080/cics-java-liberty-jdbc/database` -If the EMP table is available, the full sample can be accessed with the following URL: [http://zos.example.com:9080/cics-java-liberty-jdbc-web/](http://zos.example.com:9080/cics-java-liberty-jdbc-web/). This is a HTML page that communicates with a servlet backend to display the employees in the EMP table. + If successful, you will see a response like: + ``` + Db2 current timestamp: 2024-01-01 09:30:00.000000. + ``` +3. If the `EMP` table is available, access the full employee browser at: + `http://hostname:9080/cics-java-liberty-jdbc/` + This HTML page communicates with the servlet backend to display employees from the `EMP` table. +## Additional Resources -## Reference -* Sample SQLJ Git repository [cics-java-liberty-sqlj](https://github.com/cicsdev/cics-java-liberty-sqlj) -* CICS Knowledge Center [Configuring a Liberty JVM server](https://www.ibm.com/docs/en/cics-ts/latest?topic=server-configuring-liberty-jvm) -* CICS Knowledge Center [Configuring a JVM server to support Db2](https://www.ibm.com/docs/en/cics-ts/latest?topic=programs-configuring-jvm-server-support-db2) +- [CICS TS Documentation](https://www.ibm.com/docs/en/cics-ts) +- [WebSphere Liberty Documentation](https://www.ibm.com/docs/en/was-liberty) +- [Db2 EMP sample table](https://www.ibm.com/docs/en/db2-for-zos/latest?topic=tables-employee-table-dsn8d10emp) +- [Db2 sample tables](https://www.ibm.com/docs/en/db2-for-zos/latest?topic=zos-db2-sample-tables) ## License + This project is licensed under [Apache License Version 2.0](LICENSE). + +## Contributing + +This sample is maintained by IBM CICS development. We welcome bug reports and feature requests via GitHub Issues. Contributions are welcome and reviewed on a case-by-case basis — please read the [contributing guidelines](https://github.com/cicsdev/.github/blob/main/CONTRIBUTING.md) before opening a pull request. For CICS product questions, contact IBM Support. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9089e29 --- /dev/null +++ b/build.gradle @@ -0,0 +1,10 @@ +allprojects +{ + group = 'com.ibm.cicsdev' + version = '1.0.0' + + repositories + { + mavenCentral() + } +} diff --git a/cics-java-liberty-jdbc-web/.classpath b/cics-java-liberty-jdbc-app/.classpath similarity index 57% rename from cics-java-liberty-jdbc-web/.classpath rename to cics-java-liberty-jdbc-app/.classpath index 3497b68..9ec3a1e 100644 --- a/cics-java-liberty-jdbc-web/.classpath +++ b/cics-java-liberty-jdbc-app/.classpath @@ -6,11 +6,21 @@ - + - + + + + + + + + + + + - \ No newline at end of file + diff --git a/cics-java-liberty-jdbc-web/.gitignore b/cics-java-liberty-jdbc-app/.gitignore similarity index 100% rename from cics-java-liberty-jdbc-web/.gitignore rename to cics-java-liberty-jdbc-app/.gitignore diff --git a/cics-java-liberty-jdbc-web/.project b/cics-java-liberty-jdbc-app/.project similarity index 78% rename from cics-java-liberty-jdbc-web/.project rename to cics-java-liberty-jdbc-app/.project index 5e5286c..8683f84 100644 --- a/cics-java-liberty-jdbc-web/.project +++ b/cics-java-liberty-jdbc-app/.project @@ -1,6 +1,6 @@ - cics-java-liberty-jdbc-web + cics-java-liberty-jdbc-app @@ -30,16 +30,6 @@ - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - org.eclipse.jdt.core.javanature @@ -48,6 +38,5 @@ org.eclipse.jem.workbench.JavaEMFNature org.eclipse.m2e.core.maven2Nature org.eclipse.buildship.core.gradleprojectnature - org.eclipse.pde.PluginNature diff --git a/cics-java-liberty-jdbc-web/.settings/.jsdtscope b/cics-java-liberty-jdbc-app/.settings/.jsdtscope similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/.jsdtscope rename to cics-java-liberty-jdbc-app/.settings/.jsdtscope diff --git a/cics-java-liberty-jdbc-app/.settings/org.eclipse.buildship.core.prefs b/cics-java-liberty-jdbc-app/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/cics-java-liberty-jdbc-app/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.core.resources.prefs b/cics-java-liberty-jdbc-app/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.core.resources.prefs rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.core.resources.prefs diff --git a/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.apt.core.prefs b/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..d4313d4 --- /dev/null +++ b/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.core.prefs b/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1d3fc37 --- /dev/null +++ b/cics-java-liberty-jdbc-app/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.m2e.core.prefs b/cics-java-liberty-jdbc-app/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.m2e.core.prefs rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.m2e.core.prefs diff --git a/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.component b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..89cc560 --- /dev/null +++ b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.project.facet.core.xml b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.project.facet.core.xml similarity index 86% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.project.facet.core.xml rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.project.facet.core.xml index 5c70e35..ccba923 100644 --- a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -3,7 +3,7 @@ - + diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.jsdt.ui.superType.container b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.jsdt.ui.superType.container similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.jsdt.ui.superType.container rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.jsdt.ui.superType.container diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.jsdt.ui.superType.name b/cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.jsdt.ui.superType.name similarity index 100% rename from cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.jsdt.ui.superType.name rename to cics-java-liberty-jdbc-app/.settings/org.eclipse.wst.jsdt.ui.superType.name diff --git a/cics-java-liberty-jdbc-app/build.gradle b/cics-java-liberty-jdbc-app/build.gradle new file mode 100644 index 0000000..110c084 --- /dev/null +++ b/cics-java-liberty-jdbc-app/build.gradle @@ -0,0 +1,45 @@ +plugins +{ + id 'java' + id 'eclipse' + id 'idea' + id 'war' +} + +java +{ + toolchain + { + languageVersion = JavaLanguageVersion.of(java_version) + } +} + +eclipse +{ + classpath + { + downloadJavadoc = true + } + wtp + { + facet + { + facet name: 'jst.web', version: '3.1' + } + component + { + contextPath = 'cics-java-liberty-jdbc' + } + } +} + +war +{ + archiveFileName = 'cics-java-liberty-jdbc.war' +} + +dependencies +{ + compileOnly 'javax.servlet:javax.servlet-api:3.1.0' + compileOnly 'javax.annotation:javax.annotation-api:1.2' +} diff --git a/cics-java-liberty-jdbc-web/build.properties b/cics-java-liberty-jdbc-app/build.properties similarity index 70% rename from cics-java-liberty-jdbc-web/build.properties rename to cics-java-liberty-jdbc-app/build.properties index b9feb72..6f6b4a0 100644 --- a/cics-java-liberty-jdbc-web/build.properties +++ b/cics-java-liberty-jdbc-app/build.properties @@ -4,4 +4,4 @@ web.content.dir = src/main/webapp jre.compilation.profile = JavaSE-1.8 -war.name = cics-java-liberty-jdbc-web.war \ No newline at end of file +war.name = cics-java-liberty-jdbc.war \ No newline at end of file diff --git a/cics-java-liberty-jdbc-web/pom.xml b/cics-java-liberty-jdbc-app/pom.xml similarity index 60% rename from cics-java-liberty-jdbc-web/pom.xml rename to cics-java-liberty-jdbc-app/pom.xml index ca38521..71bde6b 100644 --- a/cics-java-liberty-jdbc-web/pom.xml +++ b/cics-java-liberty-jdbc-app/pom.xml @@ -2,7 +2,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -11,24 +11,25 @@ 1.0.0 - cics-java-liberty-jdbc-web + cics-java-liberty-jdbc-app war - CICS Liberty JDBC Application - Web + CICS Liberty JDBC Application - App This module exposes information from Db2 in a servlet. + cics-java-liberty-jdbc - - org.apache.maven.plugins - maven-war-plugin - 3.4.0 - - - false - - - + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + + + false + + + @@ -46,4 +47,4 @@ provided - \ No newline at end of file + diff --git a/cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseService.java b/cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseService.java similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseService.java rename to cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseService.java diff --git a/cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseServlet.java b/cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseServlet.java similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseServlet.java rename to cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/DatabaseServlet.java diff --git a/cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/Employee.java b/cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/Employee.java similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/Employee.java rename to cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/Employee.java diff --git a/cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeService.java b/cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeService.java similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeService.java rename to cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeService.java diff --git a/cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeServlet.java b/cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeServlet.java similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeServlet.java rename to cics-java-liberty-jdbc-app/src/main/java/com/ibm/cicsdev/liberty/jdbc/employee/EmployeeServlet.java diff --git a/cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/ibm-web-ext.xml b/cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/ibm-web-ext.xml new file mode 100644 index 0000000..97f2520 --- /dev/null +++ b/cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/ibm-web-ext.xml @@ -0,0 +1,8 @@ + + + + diff --git a/cics-java-liberty-jdbc-web/src/main/webapp/WEB-INF/web.xml b/cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/web.xml similarity index 83% rename from cics-java-liberty-jdbc-web/src/main/webapp/WEB-INF/web.xml rename to cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/web.xml index c1f8fc3..55d2f65 100644 --- a/cics-java-liberty-jdbc-web/src/main/webapp/WEB-INF/web.xml +++ b/cics-java-liberty-jdbc-app/src/main/webapp/WEB-INF/web.xml @@ -2,5 +2,5 @@ - com.ibm.cicsdev.jdbc.web + cics-java-liberty-jdbc diff --git a/cics-java-liberty-jdbc-web/src/main/webapp/favicon-32x32.png b/cics-java-liberty-jdbc-app/src/main/webapp/favicon-32x32.png similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/webapp/favicon-32x32.png rename to cics-java-liberty-jdbc-app/src/main/webapp/favicon-32x32.png diff --git a/cics-java-liberty-jdbc-web/src/main/webapp/index.html b/cics-java-liberty-jdbc-app/src/main/webapp/index.html similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/webapp/index.html rename to cics-java-liberty-jdbc-app/src/main/webapp/index.html diff --git a/cics-java-liberty-jdbc-web/src/main/webapp/scripts/employee.js b/cics-java-liberty-jdbc-app/src/main/webapp/scripts/employee.js similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/webapp/scripts/employee.js rename to cics-java-liberty-jdbc-app/src/main/webapp/scripts/employee.js diff --git a/cics-java-liberty-jdbc-web/src/main/webapp/styles/cics.css b/cics-java-liberty-jdbc-app/src/main/webapp/styles/cics.css similarity index 100% rename from cics-java-liberty-jdbc-web/src/main/webapp/styles/cics.css rename to cics-java-liberty-jdbc-app/src/main/webapp/styles/cics.css diff --git a/cics-java-liberty-jdbc-bundle/.settings/org.eclipse.buildship.core.prefs b/cics-java-liberty-jdbc-bundle/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 9d10e56..0000000 --- a/cics-java-liberty-jdbc-bundle/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir=../cics-java-liberty-jdbc-web -eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false \ No newline at end of file diff --git a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.project b/cics-java-liberty-jdbc-cicsbundle-eclipse/.project similarity index 73% rename from etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.project rename to cics-java-liberty-jdbc-cicsbundle-eclipse/.project index 913ed1e..d64e495 100644 --- a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.project +++ b/cics-java-liberty-jdbc-cicsbundle-eclipse/.project @@ -1,6 +1,6 @@ - com.ibm.cics.server.examples.wlp.jdbc.bundle + cics-java-liberty-jdbc-cicsbundle-eclipse @@ -10,19 +10,19 @@ bundleID - com.ibm.cics.server.examples.wlp.jdbc.bundle + cics-java-liberty-jdbc-bundle majorVersion - + 1 microVersion - + 0 minorVersion - + 0 @@ -30,4 +30,4 @@ com.ibm.cics.bundle.ui.bundlenature - \ No newline at end of file + diff --git a/cics-java-liberty-jdbc-cicsbundle-eclipse/.settings/org.eclipse.core.resources.prefs b/cics-java-liberty-jdbc-cicsbundle-eclipse/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/cics-java-liberty-jdbc-cicsbundle-eclipse/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/META-INF/cics.xml b/cics-java-liberty-jdbc-cicsbundle-eclipse/META-INF/cics.xml similarity index 57% rename from etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/META-INF/cics.xml rename to cics-java-liberty-jdbc-cicsbundle-eclipse/META-INF/cics.xml index 135c44e..6279e13 100644 --- a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/META-INF/cics.xml +++ b/cics-java-liberty-jdbc-cicsbundle-eclipse/META-INF/cics.xml @@ -1,7 +1,7 @@ - + 2017-08-01T09:50:06.715+01:00 - + diff --git a/cics-java-liberty-jdbc-cicsbundle-eclipse/cics-java-liberty-jdbc-app.warbundle b/cics-java-liberty-jdbc-cicsbundle-eclipse/cics-java-liberty-jdbc-app.warbundle new file mode 100644 index 0000000..03daa77 --- /dev/null +++ b/cics-java-liberty-jdbc-cicsbundle-eclipse/cics-java-liberty-jdbc-app.warbundle @@ -0,0 +1,2 @@ + + diff --git a/cics-java-liberty-jdbc-bundle/.project b/cics-java-liberty-jdbc-cicsbundle/.project similarity index 91% rename from cics-java-liberty-jdbc-bundle/.project rename to cics-java-liberty-jdbc-cicsbundle/.project index fe73fe3..c7c9c96 100644 --- a/cics-java-liberty-jdbc-bundle/.project +++ b/cics-java-liberty-jdbc-cicsbundle/.project @@ -1,6 +1,6 @@ - cics-java-liberty-jdbc-bundle + cics-java-liberty-jdbc-cicsbundle diff --git a/cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.buildship.core.prefs b/cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/cics-java-liberty-jdbc-bundle/.settings/org.eclipse.core.resources.prefs b/cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from cics-java-liberty-jdbc-bundle/.settings/org.eclipse.core.resources.prefs rename to cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.core.resources.prefs diff --git a/cics-java-liberty-jdbc-bundle/.settings/org.eclipse.ltk.core.refactoring.prefs b/cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.ltk.core.refactoring.prefs similarity index 100% rename from cics-java-liberty-jdbc-bundle/.settings/org.eclipse.ltk.core.refactoring.prefs rename to cics-java-liberty-jdbc-cicsbundle/.settings/org.eclipse.ltk.core.refactoring.prefs diff --git a/cics-java-liberty-jdbc-bundle/build.gradle b/cics-java-liberty-jdbc-cicsbundle/build.gradle similarity index 50% rename from cics-java-liberty-jdbc-bundle/build.gradle rename to cics-java-liberty-jdbc-cicsbundle/build.gradle index ed6f4b6..6553387 100644 --- a/cics-java-liberty-jdbc-bundle/build.gradle +++ b/cics-java-liberty-jdbc-cicsbundle/build.gradle @@ -1,16 +1,19 @@ -plugins { - id 'com.ibm.cics.bundle' version "1.0.7" +plugins +{ + id 'com.ibm.cics.bundle' version '1.0.8' } -dependencies { - cicsBundlePart project(path: ':cics-java-liberty-jdbc-web', configuration: 'archives') +dependencies +{ + cicsBundlePart project(path: ':cics-java-liberty-jdbc-app', configuration: 'archives') } -cicsBundle { - build { +cicsBundle +{ + build + { defaultJVMServer = project.findProperty("cics.jvmserver") ?: "DFHWLP" } } description = 'CICS Liberty JDBC Application - CICS Bundle' -version = "1.0.0" \ No newline at end of file diff --git a/cics-java-liberty-jdbc-bundle/pom.xml b/cics-java-liberty-jdbc-cicsbundle/pom.xml similarity index 80% rename from cics-java-liberty-jdbc-bundle/pom.xml rename to cics-java-liberty-jdbc-cicsbundle/pom.xml index 1b54c11..09f8e76 100644 --- a/cics-java-liberty-jdbc-bundle/pom.xml +++ b/cics-java-liberty-jdbc-cicsbundle/pom.xml @@ -2,7 +2,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -11,7 +11,7 @@ 1.0.0 - cics-java-liberty-jdbc-bundle + cics-java-liberty-jdbc-cicsbundle CICS Liberty JDBC Application - CICS Bundle This module packages the web module into a CICS bundle. @@ -21,7 +21,7 @@ ${project.groupId} - cics-java-liberty-jdbc-web + cics-java-liberty-jdbc-app ${project.version} war @@ -32,7 +32,7 @@ com.ibm.cics cics-bundle-maven-plugin - 1.0.7 + 1.0.8 true ${cics.jvmserver} @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.buildship.core.prefs b/cics-java-liberty-jdbc-web/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 60b1463..0000000 --- a/cics-java-liberty-jdbc-web/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false \ No newline at end of file diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.apt.core.prefs b/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.apt.core.prefs deleted file mode 100644 index 27769d2..0000000 --- a/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.apt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.apt.aptEnabled=false -org.eclipse.jdt.apt.genSrcDir=.apt_generated -org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests -org.eclipse.jdt.apt.reconcileEnabled=true \ No newline at end of file diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.core.prefs b/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index a361f77..0000000 --- a/cics-java-liberty-jdbc-web/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,15 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 \ No newline at end of file diff --git a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.component b/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.component deleted file mode 100644 index 0d23bd7..0000000 --- a/cics-java-liberty-jdbc-web/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cics-java-liberty-jdbc-web/build.gradle b/cics-java-liberty-jdbc-web/build.gradle deleted file mode 100644 index 9648e82..0000000 --- a/cics-java-liberty-jdbc-web/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins -{ - id 'java' - id 'eclipse' - id 'idea' - id 'war' -} - -group = 'com.ibm.cicsdev' -archivesBaseName='cics-java-liberty-jdbc' -version = '1.0.0' - - -// If in Eclipse, add Javadoc to the local project classpath -eclipse -{ - classpath - { - downloadJavadoc = true - } -} - - -repositories -{ - mavenCentral() -} - - -dependencies -{ - compileOnly 'javax.servlet:javax.servlet-api:3.1.0' - compileOnly 'javax.annotation:javax.annotation-api:1.2' -} diff --git a/etc/config/liberty/db2/type2.xml b/etc/config/liberty/db2/type2.xml index 29c5bd0..f44cf1f 100644 --- a/etc/config/liberty/db2/type2.xml +++ b/etc/config/liberty/db2/type2.xml @@ -2,7 +2,7 @@ - + diff --git a/etc/config/liberty/server.xml b/etc/config/liberty/server.xml index 8fd8c10..c018c32 100644 --- a/etc/config/liberty/server.xml +++ b/etc/config/liberty/server.xml @@ -4,7 +4,7 @@ cicsts:core-1.0 - jsp-2.3 + servlet-3.1 jdbc-4.1 diff --git a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.settings/org.eclipse.core.resources.prefs b/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 9c72a69..0000000 --- a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//META-INF/cics.xml=UTF-8 -encoding/=UTF-8 -encoding/cics-java-liberty-jdbc-web.warbundle=UTF-8 \ No newline at end of file diff --git a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/cics-java-liberty-jdbc-web.warbundle b/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/cics-java-liberty-jdbc-web.warbundle deleted file mode 100644 index 72f3b77..0000000 --- a/etc/eclipse_projects/com.ibm.cicsdev.jdbc.web.cicsbundle/cics-java-liberty-jdbc-web.warbundle +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..fe3bdf1 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,9 @@ +java_version = 8 + +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.java.installations.auto-detect=true +org.gradle.java.installations.auto-download=true + +# Configuration cache disabled — CICS Bundle Plugin 1.0.8 is not compatible +# org.gradle.configuration-cache=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..03b32a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 -validateDistributionUrl=true +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mvnw b/mvnw index 41c0f0c..6deb5c2 100755 --- a/mvnw +++ b/mvnw @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script +# Apache Maven Wrapper startup batch script, version @@project.version@@ # # Required ENV vars: # ------------------ @@ -27,284 +27,312 @@ # # Optional ENV vars # ----------------- -# M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- -if [ -z "$MAVEN_SKIP_RC" ] ; then +if [ -z "$MAVEN_SKIP_RC" ]; then - if [ -f /etc/mavenrc ] ; then + if [ -f /usr/local/etc/mavenrc ]; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ]; then . /etc/mavenrc fi - if [ -f "$HOME/.mavenrc" ] ; then + if [ -f "$HOME/.mavenrc" ]; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; +cygwin=false +darwin=false mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi +case "$(uname)" in +CYGWIN*) cygwin=true ;; +MINGW*) mingw=true ;; +Darwin*) + darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)" + export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home" + export JAVA_HOME fi - ;; + fi + ;; esac -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` +if [ -z "$JAVA_HOME" ]; then + if [ -r /etc/gentoo-release ]; then + JAVA_HOME=$(java-config --jre-home) fi fi -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - # For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +if $cygwin; then + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") fi # For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +if $mingw; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] \ + && JAVA_HOME="$( + cd "$JAVA_HOME" || ( + echo "cannot cd into $JAVA_HOME." >&2 + exit 1 + ) + pwd + )" fi if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin; then + javaHome="$(dirname "$javaExecutable")" + javaExecutable="$(cd "$javaHome" && pwd -P)/javac" else - javaExecutable="`readlink -f \"$javaExecutable\"`" + javaExecutable="$(readlink -f "$javaExecutable")" fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` + javaHome="$(dirname "$javaExecutable")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +if [ -z "$JAVACMD" ]; then + if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`which java`" + JAVACMD="$( + \unset -f command 2>/dev/null + \command -v java + )" fi fi -if [ ! -x "$JAVACMD" ] ; then +if [ ! -x "$JAVACMD" ]; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." +if [ -z "$JAVA_HOME" ]; then + echo "Warning: JAVA_HOME environment variable is not set." >&2 fi -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" + if [ -z "$1" ]; then + echo "Path not specified to find_maven_basedir" >&2 return 1 fi basedir="$1" wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then + while [ "$wdir" != '/' ]; do + if [ -d "$wdir"/.mvn ]; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` + wdir=$( + cd "$wdir/.." || exit 1 + pwd + ) fi # end of workaround done - echo "${basedir}" + printf '%s' "$( + cd "$basedir" || exit 1 + pwd + )" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' <"$1" fi } -BASE_DIR=`find_maven_basedir "$(pwd)"` +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") if [ -z "$BASE_DIR" ]; then - exit 1; + exit 1 fi +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + ########################################################################################## # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central # This allows using the maven wrapper in projects that prohibit checking in binary data. ########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar" + fi + while IFS="=" read -r key value; do + case "$key" in wrapperUrl) + wrapperUrl=$(trim "${value-}") + break + ;; + esac + done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget >/dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget ${QUIET:+"$QUIET"} "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + wget ${QUIET:+"$QUIET"} --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" + elif command -v curl >/dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl ${QUIET:+"$QUIET"} -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl ${QUIET:+"$QUIET"} --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi fi + fi fi ########################################################################################## # End of extension ########################################################################################## -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in wrapperSha256Sum) + wrapperSha256Sum=$(trim "${value-}") + break + ;; + esac +done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c - >/dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c >/dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi fi + MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + [ -n "$JAVA_HOME" ] \ + && JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] \ + && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] \ + && MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") fi # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +# shellcheck disable=SC2086 # safe args exec "$JAVACMD" \ $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd index 8611571..708460f 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -18,13 +18,12 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script +@REM Apache Maven Wrapper startup batch script, version @@project.version@@ @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @@ -46,8 +45,8 @@ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* :skipRcPre @setlocal @@ -60,22 +59,22 @@ set ERROR_CODE=0 @REM ==== START VALIDATION ==== if not "%JAVA_HOME%" == "" goto OkJHome -echo. +echo. >&2 echo Error: JAVA_HOME not found in your environment. >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 -echo. +echo. >&2 goto error :OkJHome if exist "%JAVA_HOME%\bin\java.exe" goto init -echo. +echo. >&2 echo Error: JAVA_HOME is set to an invalid directory. >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 -echo. +echo. >&2 goto error @REM ==== END VALIDATION ==== @@ -120,10 +119,10 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar" -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @@ -134,11 +133,11 @@ if exist %WRAPPER_JAR% ( ) ) else ( if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% + echo Downloading from: %WRAPPER_URL% ) powershell -Command "&{"^ @@ -146,7 +145,7 @@ if exist %WRAPPER_JAR% ( "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ "}" if "%MVNW_VERBOSE%" == "true" ( echo Finished downloading %WRAPPER_JAR% @@ -154,11 +153,36 @@ if exist %WRAPPER_JAR% ( ) @REM End of extension +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + @REM Provide a "standardized" way to retrieve the CLI args that will @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end @@ -168,15 +192,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause +if "%MAVEN_BATCH_PAUSE%"=="on" pause -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% -exit /B %ERROR_CODE% +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index 60b483c..82713d6 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.ibm.cicsdev @@ -15,8 +15,8 @@ https://github.com/cicsdev/cics-java-liberty-jdbc/ - cics-java-liberty-jdbc-web - cics-java-liberty-jdbc-bundle + cics-java-liberty-jdbc-app + cics-java-liberty-jdbc-cicsbundle @@ -44,4 +44,16 @@ ${java.version} - \ No newline at end of file + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + + + + diff --git a/settings.gradle b/settings.gradle index 5827de5..d5bbfd4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,9 @@ -rootProject.name = 'com.ibm.cicsdev.springboot.jdbc' +plugins +{ + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' +} -include(':cics-java-liberty-jdbc-web') -include(':cics-java-liberty-jdbc-bundle') \ No newline at end of file +rootProject.name = 'cics-java-liberty-jdbc' + +include(':cics-java-liberty-jdbc-app') +include(':cics-java-liberty-jdbc-cicsbundle')