Moditect not finding the current module when Jlinking

154 Views Asked by At

I'm using ModiTect to Jlink my Java application. Following the README and the two examples, undertow and vert.x, I added this to my pom.xml:

<execution>
    <id>create-runtime-image</id>
    <phase>package</phase>
    <goals>
        <goal>create-runtime-image</goal>
    </goals>
    <configuration>
        <modulePath>
            <path>${project.build.directory}/modules</path>
        </modulePath>
        <modules>
            <module>tech.dashman.dashman</module>
        </modules>
        <outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
    </configuration>
</execution>

I'm also using ModiTect to inject module-info.javas into the dependencies that don't have them, but I think that is irrelevant to this question. When I run mvn package it fails with this error:

[ERROR] Error: Module tech.dashman.dashman not found

That is the module this pom.xml is for. Why is it not finding it (when the examples seem to indicate it would be found automatically)?

Adding a module path made it findable:

<modulePath>
    <path>${project.build.directory}/modules</path>
    <path>${project.build.directory}/classes</path>
</modulePath>

but I had to point to the classes subdir in the target directory because if I point to target so that the jar file can be found, I get this error:

[ERROR] Error: Two versions of module tech.dashman.dashman found in C:\Users\pupeno\Documents\Dashman\code\dashman\target (dashman-1.0.0-beta.2.jar and classes)
0

There are 0 best solutions below