0

I'm creating a Maven-based JavaFX 15 application and in the process of making it modular in order to be able to use javafx:jlink to generate a runtime image for it.

To solve the issue of automatic modules I am using the Moditect plugin, but am now encountering a different error:

Execution generate-module-info of goal org.moditect:moditect-maven-plugin:1.0.0.RC1:generate-module-info failed: Unable to derive module descriptor for path\to\xalan-2.7.2.jar

These are the most important parts of my pom.xml:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <dependencies>
        <!-- ...JavaFX graphics and controls...-->

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.moditect</groupId>
            <artifactId>moditect-maven-plugin</artifactId>
            <version>1.0.0.RC1</version>
        </dependency>

        <!-- ...Other dependencies-->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>

            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.5</version>
                <configuration>
                    <mainClass>...</mainClass>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>1.0.0.RC1</version>
                <executions>
                    <execution>
                        <id>generate-module-info</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate-module-info</goal>
                        </goals>
                        <configuration>
                            <modules>
                                <!-- This is the module causing the problem -->
                                <module>
                                    <artifact>
                                        <groupId>org.apache.poi</groupId>
                                        <artifactId>poi-ooxml</artifactId>
                                        <version>5.0.0</version>
                                    </artifact>
                                </module>
                            </modules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I know there have been multiple questions asked about this already like this one, but none of their answers go into detail on how to fix the issue.

cegredev
  • 1,485
  • 2
  • 11
  • 25
  • Maybe trying to reach out to [Gunnar](https://stackoverflow.com/users/773616/gunnar) you can get the exact answer to if `moditect` can solve this case. But as I had suggested in the linked answer, a proper solution for this has to actually come from the library authors if they want to support java-platform-module-system. Evenn when under `poi-ooxml` if you patch use `xalan` and (you would also find out) `baltik-script`, you would still be stuck with `Modules batik.all and batik.gui.util export package org.apache.batik.util.gui.xmleditor to module xml.apis.ext` – Naman Jun 18 '21 at 03:21
  • Thanks, but I don't think I'll bother him with something like this. It's honestly so silly how these things never work and always requires third parties. I'll just have to let it be and ship a 300mb application. Oh well. – cegredev Jun 18 '21 at 10:28

0 Answers0