orphan-oss / launch4j-maven-plugin

A Maven plugin which wraps Launch4j
Other
368 stars 71 forks source link

How to provide main argument #301

Open aruffie opened 1 year ago

aruffie commented 1 year ago

Dear,

I have a jar which can be launch like this following command:

java -jar server.jar -conf c:\conf\default.json

And I try to make an executable with this following maven plugin:

<plugin>
                        <groupId>com.akathist.maven.plugins.launch4j</groupId>
                        <artifactId>launch4j-maven-plugin</artifactId>
                        <version>2.4.1</version>
                        <executions>
                            <execution>
                                <id>l4j-clui</id>
                                <phase>install</phase>
                                <goals><goal>launch4j</goal></goals>
                                <configuration>
                                    <headerType>console</headerType>
                                    <outfile>target/server-${project.version}.exe</outfile>
                                    <jar>target/${project.artifactId}-${server.version}-fat.jar</jar>
                                    <errTitle>server-${project.version}</errTitle>
                                    <classPath>
                                        <mainClass>com.server.core.CsLauncher</mainClass>
                                    </classPath>
                                    <cmdLine>-conf conf/dev.json</cmdLine>
                                    <jre>
                                        <path>${java.home</path>
                                        <bundledJre64Bit>false</bundledJre64Bit>
                                        <bundledJreAsFallback>false</bundledJreAsFallback>
                                        <minVersion>1.8.0</minVersion>
                                        <jdkPreference>preferJre</jdkPreference>
                                        <runtimeBits>32</runtimeBits>
                                    </jre>
                                    <versionInfo>
                                        <fileVersion>${project.version}.0</fileVersion>
                                        <txtFileVersion>Crimson Server ${project.version}</txtFileVersion>
                                        <fileDescription>The Crimson Server executable</fileDescription>
                                        <productVersion>${project.version}.0</productVersion>
                                        <txtProductVersion>The Crimson Server executable</txtProductVersion>
                                        <productName>Server</productName>
                                        <internalName>server</internalName>
                                        <originalFilename>server-${project.version}.exe</originalFilename>
                                    </versionInfo>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

Can you help me for provide the -conf and the value to the main class but byt providing it to the exe command ? Because I don't need a static value, when I launch for example: I need to make --> server.exe -conf conf\default.json

and that realise a argument providing like that: java -jar server.jar -conf c:\conf\default.json

because I want the conf value path can change

Thank for helping Adrien

lukaszlenart commented 1 year ago

The only option you have is to use Additional JVM options at runtime