Skip to content

Commit

Permalink
Initial code cleanup, Quarkus 3.8 LTS, fixed versions, Dev UI
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 1, 2024
1 parent 01d2fe5 commit 1252db1
Show file tree
Hide file tree
Showing 19 changed files with 694 additions and 325 deletions.
24 changes: 23 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,26 @@ updates:
schedule:
interval: "daily"
ignore:
- dependency-name: "org.apache.maven.plugins:maven-compiler-plugin"
- dependency-name: "io.quarkus:quarkus-bom"
- dependency-name: "io.quarkus:quarkus-maven-plugin"
- dependency-name: "io.quarkus:quarkus-extension-processor"
- dependency-name: "io.quarkus:quarkus-extension-maven-plugin"
groups:
quarkus:
patterns:
- "io.quarkus*"
- "quarkus*"
quarkiverse:
patterns:
- "io.quarkiverse*"
dependencies:
patterns:
- "*"
exclude-patterns:
- "io.quarkus*"
- "quarkus*"
- "io.quarkiverse*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
3 changes: 1 addition & 2 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
release:
current-version: "schmalnau"
next-version: "lütter-SNAPSHOT"

next-version: "lütter-SNAPSHOT"
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,24 @@ jobs:
strategy:
fail-fast: false
matrix:
# os: [windows-latest, macos-latest, ubuntu-latest]
os: [ubuntu-latest]
# os: [windows-latest, macos-latest, ubuntu-latest]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git
run: git config --global core.autocrlf false
if: startsWith(matrix.os, 'windows')

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

- name: Build with Maven
run: mvn -B clean verify -Dno-format
run: mvn -B clean install -Dno-format

# Native won't work anyway
# - name: Build with Maven (Native)
# run: mvn -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip -Dno-format
#- name: Build with Maven (Native)
#run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip
8 changes: 4 additions & 4 deletions .github/workflows/quarkus-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ jobs:

steps:
- name: Install yq
uses: dcarbone/install-yq-action@v1.0.1
uses: dcarbone/install-yq-action@v1.1.1

- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}

- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: current-repo

- name: Checkout Ecosystem
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ env.ECOSYSTEM_CI_REPO }}
path: ecosystem-ci
Expand Down
78 changes: 66 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,79 @@
# Quarkus Jasperreports
<div align="center">
<img src="https://github.com/quarkiverse/quarkus-jasperreports/blob/main/docs/modules/ROOT/assets/images/quarkus.svg" width="67" height="70" ><img src="https://github.com/quarkiverse/quarkus-jasperreports/blob/main/docs/modules/ROOT/assets/images/plus-sign.svg" height="70" ><img src="https://github.com/quarkiverse/quarkus-jasperreports/blob/main/docs/modules/ROOT/assets/images/jasperreports.svg" height="70" >

# Quarkus JasperReports
</div>
<br>

[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.jasperreports/quarkus-jasperreports?logo=apache-maven&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.jasperreports/quarkus-jasperreports)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
[![Build](https://github.com/quarkiverse/quarkus-jasperreports/actions/workflows/build.yml/badge.svg)](https://github.com/quarkiverse/quarkus-jasperreports/actions/workflows/build.yml)

A Quarkus extension that lets you utilize [JasperReports](https://community.jaspersoft.com/download-jaspersoft/community-edition/). JasperReports is an open source Java reporting tool that can write to a variety of targets, such as: screen, a printer, into PDF, HTML, Microsoft Excel, RTF, ODT, comma-separated values (CSV), XSL, or XML files.

## Getting started

Read the full [JasperReports documentation](https://docs.quarkiverse.io/quarkus-jasperreports/dev/index.html).

### Installation

Create a new JasperReports project (with a base jasperreports starter code):

- With [code.quarkus.io](https://code.quarkus.io/?a=jasperreports-bowl&j=17&e=io.quarkiverse.jasperreports%3Aquarkus-jasperreports)
- With the [Quarkus CLI](https://quarkus.io/guides/cli-tooling):

```bash
quarkus create app jasperreports-app -x=io.quarkiverse.jasperreports:quarkus-jasperreports
```
Or add to you pom.xml directly:

```xml
<dependency>
<groupId>io.quarkiverse.jasperreports</groupId>
<artifactId>quarkus-jasperreports</artifactId>
<version>{project-version}</version>
</dependency>
```

## Welcome to Quarkiverse!
## Docker

Congratulations and thank you for creating a new Quarkus extension project in Quarkiverse!
When building native images in Docker using the standard Quarkus Docker configuration files some additional features need to be installed to support fonts. Specifically font information is not included in [Red Hat's ubi-minimal images](https://developers.redhat.com/products/rhel/ubi). To install it
simply add these lines to your `DockerFile.native` file:

Feel free to replace this content with the proper description of your new project and necessary instructions how to use and contribute to it.
```shell
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9

You can find the basic info, Quarkiverse policies and conventions in [the Quarkiverse wiki](https://github.com/quarkiverse/quarkiverse/wiki).
######################### Set up environment for POI #############################
RUN microdnf update && microdnf install freetype fontconfig && microdnf clean all
######################### Set up environment for POI #############################

In case you are creating a Quarkus extension project for the first time, please follow [Building My First Extension](https://quarkus.io/guides/building-my-first-extension) guide.
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
# Shared objects to be dynamically loaded at runtime as needed,
COPY --chown=1001:root target/*.properties target/*.so /work/
COPY --chown=1001:root target/*-runner /work/application
# Permissions fix for Windows
RUN chmod "ugo+x" /work/application
EXPOSE 8080
USER 1001

Other useful articles related to Quarkus extension development can be found under the [Writing Extensions](https://quarkus.io/guides/#writing-extensions) guide category on the [Quarkus.io](https://quarkus.io) website.
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
```

Thanks again, good luck and have fun!
> [!CAUTION]
> Make sure `.dockerignore` does not exclude `.so` files!
## Documentation
## 🧑‍💻 Contributing

The documentation for this extension should be maintained as part of this repository and it is stored in the `docs/` directory.
- Contribution is the best way to support and get involved in community!
- Please, consult our [Code of Conduct](./CODE_OF_CONDUCT.md) policies for interacting in our community.
- Contributions to `quarkus-jasperreports` Please check our [CONTRIBUTING.md](./CONTRIBUTING.md)

The layout should follow the [Antora's Standard File and Directory Set](https://docs.antora.org/antora/2.3/standard-directories/).
### If you have any idea or question 🤷

Once the docs are ready to be published, please open a PR including this repository in the [Quarkiverse Docs Antora playbook](https://github.com/quarkiverse/quarkiverse-docs/blob/main/antora-playbook.yml#L7). See an example [here](https://github.com/quarkiverse/quarkiverse-docs/pull/1).
- [Ask a question](https://github.com/quarkiverse/quarkus-jasperreports/discussions)
- [Raise an issue](https://github.com/quarkiverse/quarkus-jasperreports/issues)
- [Feature request](https://github.com/quarkiverse/quarkus-jasperreports/issues)
- [Code submission](https://github.com/quarkiverse/quarkus-jasperreports/pulls)
98 changes: 52 additions & 46 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.jasperreports</groupId>
<artifactId>quarkus-jasperreports-parent</artifactId>
<version>lütter-SNAPSHOT</version>
</parent>
<artifactId>quarkus-jasperreports-deployment</artifactId>
<name>Quarkus Jasperreports - Deployment</name>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${version.quarkus}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.jasperreports</groupId>
<artifactId>quarkus-jasperreports-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<artifactId>quarkus-jasperreports-deployment</artifactId>
<name>Quarkus JasperReports - Deployment</name>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.jasperreports</groupId>
<artifactId>quarkus-jasperreports</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jackson-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.jasperreports</groupId>
<artifactId>quarkus-jasperreports</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${version.quarkus}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,47 @@
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;

class JasperreportsProcessor {

private static final String FEATURE = "jasperreports";
private static final String EXTENSIONS_FILE = "jasperreports_extension.properties";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
UberJarMergedResourceBuildItem mergeResource() {
return new UberJarMergedResourceBuildItem(EXTENSIONS_FILE);
}

@BuildStep
void runtimeInits(BuildProducer<RuntimeInitializedClassBuildItem> producer) {
// TODO: Test what is really needed for native to work
// see also https://github.com/quarkusio/quarkus/issues/31224
producer.produce(new RuntimeInitializedClassBuildItem("net.sf.jasperreports.engine.SimpleReportContext"));
producer.produce(new RuntimeInitializedClassBuildItem("net.sf.jasperreports.engine.design.JRAbstractCompiler"));
}
}

@BuildStep
void substrateResourceBuildItems(BuildProducer<NativeImageResourceBuildItem> nativeImageResourceProducer,
BuildProducer<NativeImageResourceBundleBuildItem> resourceBundleBuildItem) {
nativeImageResourceProducer.produce(new NativeImageResourceBuildItem(
EXTENSIONS_FILE,
"default.jasperreports.properties",
"jasperreports_messages.properties",
"metadata_messages.properties",
"metadata_messages-defaults.properties",
"properties-metadata.json"));

resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("jasperreports_messages"));
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages"));
resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages-defaults"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.quarkiverse.jasperreports.deployment.devui;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.ExternalPageBuilder;
import io.quarkus.devui.spi.page.Page;
import net.sf.jasperreports.engine.JasperReport;

public class JasperReportsDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void createVersion(BuildProducer<CardPageBuildItem> cardPageBuildItemBuildProducer) {
final CardPageBuildItem card = new CardPageBuildItem();

final ExternalPageBuilder versionPage = Page.externalPageBuilder("Jasper Version")
.icon("font-awesome-regular:file-pdf")
.url("https://community.jaspersoft.com/download-jaspersoft/community-edition/")
.doNotEmbed()
.staticLabel(JasperReport.class.getPackage().getSpecificationVersion());

card.addPage(versionPage);

card.setCustomCard("qwc-jasperreports-card.js");

cardPageBuildItemBuildProducer.produce(card);
}
}
Loading

0 comments on commit 1252db1

Please sign in to comment.