0

I have a maven module-based project with the following module-info.java :

module optoadc_device_control {
    requires com.google.gson;

    exports optoadc_device_control.config_parser to com.google.gson;

    exports optoadc_device_control;
}

I create an uber-jar using the following configuration :

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.4.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <shadedArtifactAttached>false</shadedArtifactAttached>
                        <transformers>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>optoadc_device_control.Main</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Then I want to use this uber jar as a dependency for another javafx-based project :

    <dependency>
        <groupId>mygroup</groupId>
        <artifactId>optoadc_control</artifactId>
        <version>1.0</version>
    </dependency>

The problem I have is that I have to use artifact-based module name here :

requires optoadc.control;

but not the one used in module-info optoadc_device_control

What should be done to specify uber-jar module name from module-info file rather than from artifactId using maven ? Is it even possible ?

Dmitry
  • 1,912
  • 2
  • 18
  • 29
  • You have defined the module name `optoadc_device_control` which means you have to use that... So your requires has to use the same name... – khmarbaise Oct 20 '22 at 07:45

0 Answers0