beryx / badass-jlink-plugin

Create a custom runtime image of your modular application
https://badass-jlink-plugin.beryx.org
Apache License 2.0
386 stars 27 forks source link

Dependencies/Modules org.apache.poi:poi:5.2.5 #264

Open smnet-git opened 9 months ago

smnet-git commented 9 months ago

I can't seem to integrate libraries org.apache.poi:poi into my project (JavaFX with Java21 and Gradle) when I start task jpackage. Maybe I'm too stupid and I think I've tried everything.

During task createMergedModule I get the following errors:

Fehler: Modul nicht gefunden: org.apache.poi.poi
   requires org.apache.poi.poi;
Fehler: Modul nicht gefunden: org.apache.poi.ooxml
   requires org.apache.poi.ooxml;

They are written in German, but the meaning is that it cannot find the modules.

Where do I go wrong? I give you the entire project configuration below:

NB: for list mergedModule I used task suggestMergedModuleInfo Thank you in advance.

File: module-info.java

module my.domain.modulename {

    requires java.base;
    requires java.desktop;
    requires java.sql;

    requires javafx.controls;
    requires javafx.fxml;
    requires javafx.swing;
    requires javafx.web;

    requires org.apache.httpcomponents.httpcore;
    requires org.apache.httpcomponents.httpclient;
    requires org.apache.commons.io;
    requires org.apache.pdfbox;
    requires org.apache.tika.core;

    requires jasperreports;
    requires com.github.librepdf.openpdf;
    requires com.github.librepdf.pdfFontsExtra;
    requires org.apache.poi.poi;
    requires org.apache.poi.ooxml;
    requires org.apache.poi.ooxml.schemas;

    requires ini4j;

    requires org.json;

    requires org.jsoup;

    opens ... to javafx.fxml;
    opens ... to commons.beanutils;

    exports my.domain.projectname;
}

File: build.gradle

plugins {
    id 'java-library'
    id 'application'
    id 'org.javamodularity.moduleplugin' version '1.8.12'
    id 'org.openjfx.javafxplugin' version '0.1.0'
    id 'org.beryx.jlink' version '3.0.1'
}

group 'my.domain'
version '1.0.0'

def fullName = 'App Name'
def vendorName = 'Vendor'
def year = new Date().format("yyyy")

repositories {
    mavenCentral()
}

sourceCompatibility = '21'
targetCompatibility = '21'

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
    options.compilerArgs << '-Xlint:unchecked'
    options.deprecation = true
}

application {
    mainModule = 'my.domain.modulename'
    mainClass = 'my.domain.projectname.MainClass'
}

javafx {
    version = '21'
    modules = ['javafx.base', 'javafx.controls', 'javafx.fxml',
               'javafx.graphics', 'javafx.media', 'javafx.swing', 'javafx.web']
}

dependencies {

    api 'org.jsoup:jsoup:1.17.2'
    api 'org.json:json:20240205'
    api 'org.ini4j:ini4j:0.5.4'

    api 'net.sf.jasperreports:jasperreports:6.21.2'
    api 'net.sf.jasperreports:jasperreports-fonts:6.21.2'

    api 'com.github.librepdf:openpdf:2.0.0'
    api 'com.github.librepdf:openpdf-fonts-extra:2.0.0'

    api 'org.apache.pdfbox:pdfbox:3.0.1'

    api 'org.apache.poi:poi:5.2.5'
    api 'org.apache.poi:poi-ooxml:5.2.5'

    api 'org.apache.httpcomponents:httpclient:4.5.14'
    api 'org.apache.httpcomponents:httpcore:4.4.16'
    api 'org.apache.httpcomponents:httpmime:4.5.14'

    api 'org.apache.tika:tika-core:2.9.1'
    api 'org.apache.tika:tika-parsers:2.9.1'

    api 'commons-io:commons-io:2.15.1'
}

jlink {

    options = ['--bind-services']

    launcher {
        name = 'App Name'
        mainClass = 'my.domain.projectname.MainClass'
    }

    mergedModule {
        requires 'com.fasterxml.jackson.core';
        requires 'com.fasterxml.jackson.annotation';
        requires 'com.fasterxml.jackson.databind';
        requires 'com.fasterxml.jackson.dataformat.xml';
        requires 'java.datatransfer';
        requires 'java.logging';
        requires 'java.sql';
        requires 'java.prefs';
        requires 'java.xml';
        requires 'java.desktop';
        requires 'java.security.jgss';
        requires 'java.naming';
        requires 'java.compiler';
        requires 'java.sql.rowset';
        requires 'org.apache.poi.poi';
        requires 'org.apache.poi.ooxml';
        requires 'org.apache.commons.io';
        requires 'org.slf4j';
        uses 'javax.annotation.processing.Processor';
        provides 'org.apache.tika.metadata.filter.MetadataFilter' with 'org.apache.tika.metadata.filter.NoOpFilter';
        provides 'javax.tools.JavaCompiler' with 'org.eclipse.jdt.internal.compiler.tool.EclipseCompiler';
    }

    jpackage {
        installerOptions += [
                '--name', fullName,
                '--description', fullName,
                '--app-version', version,
                '--vendor', vendorName,
                '--copyright', ('Copyright ' + year + ' ' + vendorName)
        ]
        if (org.gradle.internal.os.OperatingSystem.current().windows) {
            imageOptions += ['--icon', 'src/main/resources/icon.ico', '--resource-dir', 'src/main/resources']
            installerOptions += [
                    '--type', 'msi',
                    '--win-per-user-install',
                    // '--win-dir-chooser',
                    '--win-menu',
                    '--win-shortcut',
                    '--win-menu-group', 'MyMenuGroup',
            ]
        }
    }
}