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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build

on:
push:
branches: [ main, master, feature/next ]
pull_request:
branches: [ main, master, feature/next ]
workflow_dispatch:
inputs:
deploy:
description: 'Deploy after build?'
type: boolean
default: false
environment:
description: 'Environment to deploy to'
type: choice
options: [test, production]
default: test
workflow_call:
inputs:
deploy:
type: boolean
default: false
environment:
type: string
default: test

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Make Maven wrapper executable
run: chmod +x jacq/mvnw

- name: Build with Maven
run: cd jacq && ./mvnw -B package -DskipTests=true

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: jacq-artifacts
path: |
**/target/*.jar
**/target/*.war
jacq-birt/*.ttf
jacq-birt/*.rptdesign
jacq-*/target/*.jar
jacq-*/target/*.war
104 changes: 104 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Deploy

on:
workflow_dispatch:
inputs:
run_id:
description: 'Build workflow run ID'
required: true
type: string
environment:
description: 'Environment'
required: true
type: choice
options: [test, production]

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}

env:
WILDFLY_HOST: ${{ vars.WILDFLY_HOST }}

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: jacq-artifacts
path: artifacts
run-id: ${{ github.event.inputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: List downloaded files
run: |
echo "Listing artifacts..."
ls -R artifacts

- name: Create jacq-javaee directory
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: mkdir -p /opt/jacq-javaee/jacq-birt

- name: Copy jacq-birt files
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "artifacts/jacq-birt/*"
target: "/opt/jacq-javaee/jacq-birt/"
strip_components: 2
overwrite: true

- name: Prepare JARs for upload
run: |
mkdir -p upload
cp artifacts/jacq-common/target/jacq-common-*.jar upload/
cp artifacts/jacq-service-report/target/jacq-service-report.jar upload/
ls -l upload

- name: Copy JARs
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "upload/*"
target: "/opt/jacq-javaee/jacq-birt/"
strip_components: 1
overwrite: true

- name: Install Code-39 TTF font system-wide
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
mkdir -p /usr/share/fonts/truetype/
cp /opt/jacq-javaee/jacq-birt/Code-39-Logitogo-sene.ttf /usr/share/fonts/truetype/
chmod 644 /usr/share/fonts/truetype/Code-39-Logitogo-sene.ttf
fc-cache -fv

- name: Deploy via SSH
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "artifacts/jacq-*/target/*.war"
target: "/opt/wildfly/standalone/deployments/"
strip_components: 3
overwrite: true

- name: Restart WildFly
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.WILDFLY_HOST }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: systemctl restart wildfly
75 changes: 72 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,78 @@
Development Setup
- Netbeans (8.0.2)
- openjdk 17
- WildFly Plugin / JavaEE Edition
- WildFly 8.2
- WildFly 31.0.1.Final

Maven project can be opened directly from netbeans.

jacq-common contains JPA / JAX-RS classes / interfaces only.
jacq-service contains the actual implementation using manager classes.
jacq-service contains the actual implementation using manager classes.

# To build

We are using the the maven wrapper. So, instead of call mvn please use mvnw which is located in the `jacq` directory. For furher information
have a look at https://maven.apache.org/wrapper/index.html

This means you don't have to install maven manually.

## Skipping Tests

You can disable tests during the build process in two ways:

1. Using the command-line parameter:
```
cd jacq && ./mvnw package -DskipTests=true
```

2. Using the skip-tests profile:
```
cd jacq && ./mvnw package -Pskip-tests
```

Both methods will skip the execution of tests during the build process.


# Wildfly 31.0.1.Final

To avoid the error `ModuleNotFoundException` java.se with Java 17 you have to add in the standalone.sh following line. Add it at the beginning of the file.

```
JAVA_OPTS="$JAVA_OPTS --add-modules=java.se"
```

# GitHub Actions

This project uses GitHub Actions for continuous integration and deployment:

## Build Workflow

The build workflow automatically builds the project when changes are pushed to the main/master or feature/next branches, or when a pull request is created targeting these branches. It:

1. Sets up Java 17
2. Builds the project using the Maven wrapper (mvnw) in the `jacq` directory with tests skipped (-DskipTests=true)
3. Uploads the built artifacts (JAR and WAR files, as well as BIRT reports and fonts) for later use

You can also trigger the build workflow manually from the Actions tab in GitHub.

## Deploy Workflow

The deploy workflow is designed to automatically deploy the application to a remote WildFly server via SSH/SCP when manually triggered. It:

1. Downloads the built artifacts from a specific build run
2. Creates the necessary directories on the remote server
3. Copies JARs, WARs, BIRT reports, and fonts to the remote server
4. Installs the Code-39 TTF font system-wide
5. Restarts the WildFly service

### Required GitHub Variables and Secrets

To deploy to a remote WildFly server, you need to configure the following GitHub repository variables and secrets:

#### Variables (Settings > Secrets and variables > Actions > Variables)
- `WILDFLY_HOST`: The hostname or IP address of your WildFly server

#### Secrets (Settings > Secrets and variables > Actions > Secrets)
- `SSH_PRIVATE_KEY`: The private SSH key used for authentication on the remote server
- `GITHUB_TOKEN`: (Provided automatically by GitHub) Used to download artifacts from other workflows

These credentials are used securely by the GitHub Actions workflow to connect to your remote WildFly server and deploy the application.
4 changes: 2 additions & 2 deletions jacq-birt/hbv_worklabel.rptdesign
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
</ex-property>
<ex-property>
<name>pojoClassPath</name>
<value>/opt/jacq-javaee/jacq-birt/jacq-common-0.5.0.jar;/opt/jacq-javaee/jacq-birt/jacq-service-report.jar;</value>
<value>/opt/jacq-javaee/jacq-birt/jacq-common-0.10.0.jar;/opt/jacq-javaee/jacq-birt/jacq-service-report.jar;</value>
</ex-property>
</list-property>
<property name="pojoDataSetClassPath">/opt/jacq-javaee/jacq-birt/jacq-common-0.5.0.jar;/opt/jacq-javaee/jacq-birt/jacq-service-report.jar;</property>
<property name="pojoDataSetClassPath">/opt/jacq-javaee/jacq-birt/jacq-common-0.10.0.jar;/opt/jacq-javaee/jacq-birt/jacq-service-report.jar;</property>
</oda-data-source>
</data-sources>
<data-sets>
Expand Down
39 changes: 10 additions & 29 deletions jacq-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,59 +28,40 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.19.Final</version>
<version>6.2.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.soteria</groupId>
<artifactId>javax.security.enterprise</artifactId>
<version>1.0</version>
<groupId>jakarta.security.enterprise</groupId>
<artifactId>jakarta.security.enterprise-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<archive>
<manifestEntries>
<Dependencies>org.jboss.resteasy.resteasy-jaxrs</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.jacq.common.external.model.rest;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
package org.jacq.common.external.rest;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import org.jacq.common.external.model.rest.GeoNamesSearchResult;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/
package org.jacq.common.external.rest;

import javax.json.JsonObject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import jakarta.json.JsonObject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

/**
* JAX-RS based interface definition for image server
Expand Down
Loading
Loading