Skip to content

Commit 1e3af61

Browse files
committed
UberJar support and updated README.MD
1 parent 38e3c4a commit 1e3af61

File tree

6 files changed

+105
-7
lines changed

6 files changed

+105
-7
lines changed

README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# Quarkus extension for Apache POI
2-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
4-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1+
<div align="center">
2+
<img src="https://github.com/quarkiverse/.github/blob/main/assets/images/quarkus.svg" width="67" height="70" ><img src="https://github.com/quarkiverse/.github/blob/main/assets/images/plus-sign.svg" height="70" ><img src="https://github.com/quarkiverse/quarkus-poi/blob/main/docs/modules/ROOT/assets/images/poi.svg" height="70" >
3+
4+
# Quarkus POI
5+
</div>
6+
<br>
57

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

812
This is a Quarkus extension for Apache POI.
913

@@ -92,4 +96,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
9296

9397
<!-- ALL-CONTRIBUTORS-LIST:END -->
9498

95-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
99+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

deployment/src/main/java/io/quarkiverse/poi/deployment/POIProcessor.java

+26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package io.quarkiverse.poi.deployment;
22

3+
import java.util.List;
4+
35
import org.apache.xmlbeans.StringEnumAbstractBase;
46
import org.apache.xmlbeans.XmlObject;
57
import org.jboss.jandex.ClassInfo;
68
import org.jboss.jandex.IndexView;
79

810
import io.quarkiverse.poi.runtime.graal.POIFeature;
11+
import io.quarkus.deployment.IsNormal;
912
import io.quarkus.deployment.annotations.BuildProducer;
1013
import io.quarkus.deployment.annotations.BuildStep;
1114
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
@@ -16,6 +19,7 @@
1619
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
1720
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
1821
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
22+
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;
1923

2024
class POIProcessor {
2125

@@ -75,4 +79,26 @@ public NativeImageResourcePatternsBuildItem registerResources() {
7579
"org/apache/poi/ss/formula/function/.*\\.txt",
7680
"org/apache/poi/schemas/ooxml/.*\\.xsb").build();
7781
}
82+
83+
/**
84+
* Produces `UberJarMergedResourceBuildItem`s for each specified service file to be included in the Uber JAR.
85+
* <p>
86+
* This build step is only executed in "normal" mode and registers each of the listed services in
87+
* the `META-INF/services` directory.
88+
*
89+
* @param producer The build item producer for creating `UberJarMergedResourceBuildItem` instances.
90+
*/
91+
@BuildStep(onlyIf = IsNormal.class)
92+
void uberJarServiceLoaders(BuildProducer<UberJarMergedResourceBuildItem> producer) {
93+
List<String> serviceFiles = List.of(
94+
"org.apache.poi.extractor.ExtractorProvider",
95+
"org.apache.poi.sl.draw.ImageRenderer",
96+
"org.apache.poi.sl.usermodel.MetroShapeProvider",
97+
"org.apache.poi.sl.usermodel.SlideShowProvider",
98+
"org.apache.poi.ss.usermodel.WorkbookProvider");
99+
100+
for (String serviceFile : serviceFiles) {
101+
producer.produce(new UberJarMergedResourceBuildItem("META-INF/services/" + serviceFile));
102+
}
103+
}
78104
}
Loading

docs/modules/ROOT/assets/images/poi.svg

+1
Loading
Loading

runtime/src/main/resources/META-INF/quarkus-extension.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ metadata:
1414
- document
1515
- writer
1616
guide: "https://quarkiverse.github.io/quarkiverse-docs/quarkus-poi/dev/"
17-
icon-url: "https://poi.apache.org/images/poweredby-poi-logo.png"
17+
icon-url: "https://raw.githubusercontent.com/quarkiverse/quarkus-poi/main/docs/modules/ROOT/assets/images/poi.svg"
1818
categories:
1919
- "miscellaneous"
20-
status: "stable"
20+
status: "stable"

0 commit comments

Comments
 (0)