orphan-oss/launch4j-maven-plugin

Don't specify jar or classpath

io7m opened this issue · 5 comments

io7m commented

Hello!

I'm trying to package up a modular (in the Java 9 modules sense) command-line application. The application is run like this:

java -p lib -m com.io7m.northpike.agent.main/com.io7m.northpike.agent.main.NPAgentMain

That is, the lib directory is set as the application's module path (not class path), and the -m option specifies the main class within a module. The lib directory contains all of the jar files that make up the application, and those go onto the module path (and the class path is entirely empty).

Unfortunately, if I put together a configuration like this:

          <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>launcher-windows-x86_64</id>
                <goals>
                  <goal>launch4j</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <headerType>console</headerType>
                  <outfile>${project.build.directory}/northpike-agent.exe</outfile>
                  <jre>
                    <path>jre</path>
                  </jre>
                  <dontWrapJar>true</dontWrapJar>
                  <cmdLine>
                    -p lib -m com.io7m.northpike.agent.main/com.io7m.northpike.agent.main.NPAgentMain
                  </cmdLine>
                </configuration>
              </execution>
            </executions>
          </plugin>

I get the error:

net.sf.launch4j.BuilderException: Specify runtime path of the jar relative to the executable.

It obviously expects me to be using a single executable jar, which I'm not. Is there some way I can trick launch4j into doing the right thing?

To be honest I don't know how to help you. I could ask directly on the Launch4j page

io7m commented

Thanks, but I suspect it's just not possible. Looking through the launch4j sources, it seems like it either expects an executable jar, or the classpath. The code seems to require picking one of those two.

Yet it's still worth mentioning such requirement, maybe it will be addressed in the future

io7m commented

Entirely up to you if you want to ask. I can't stop you 😄

Could you write and link a minimum hello world app with the same structure as you need? I'd like to check something