orphan-oss / launch4j-maven-plugin

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

The parameters 'headerType', 'jre' for goal com.akathist.ma ven.plugins.launch4j:launch4j-maven-plugin:1.5.1:launch4j are missing or invalid #9

Closed kurtseebauer closed 9 years ago

kurtseebauer commented 10 years ago

I'm getting the error

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.akathist.maven.plugins.launch4j:launc
h4j-maven-plugin:1.5.2:launch4j (default-cli) on project xxx: The parameters 'headerType', 'jre' for goal com
.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.5.1:launch4j are missing or invalid
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.
java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'headerType', 'jre' for goal com.akathist.ma
ven.plugins.launch4j:launch4j-maven-plugin:1.5.2:launch4j are missing or invalid

with Version 1.5.2 of the Plugin

    <dependency>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.5.2</version>
        </dependency>

but those parameters are present in the config:

    <plugin>
                    <groupId>com.akathist.maven.plugins.launch4j</groupId>
                    <artifactId>launch4j-maven-plugin</artifactId>
                    <version>1.5.2</version>
                    <executions>
                        <execution>
                            <id>l4j-clui</id>
                            <phase>package</phase>
                            <goals>
                                <goal>launch4j</goal>
                            </goals>
                            <configuration>
                                <headerType>gui</headerType>
                                <jar>some.jar</jar>
                                <outfile>xome.exe</outfile>
                                <downloadUrl>http://java.com/download</downloadUrl>
                                <classPath>
                                    <mainClass>${mainClass}</mainClass>
                                    <cp>.</cp>
                                </classPath>
                                <icon>resources/some.ico</icon>
                                <jre>
                                    <minVersion>1.7.0</minVersion>
                                    <jdkPreference>preferJre</jdkPreference>
                                </jre>
                                <versionInfo>
                                    <fileVersion>1.0.0.0</fileVersion>
                                    <txtFileVersion>${project.version}</txtFileVersion>
                                    <fileDescription>${project.name}</fileDescription>
                                    <copyright>2012 hasCode.com</copyright>
                                    <productVersion>1.0.0.0</productVersion>
                                    <txtProductVersion>1.0.0.0</txtProductVersion>
                                    <productName>${project.name}</productName>
                                    <companyName>xxx.eu</companyName>
                                    <internalName>some</internalName>
                                    <originalFilename>some.exe</originalFilename>
                                </versionInfo>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

Windows 8.1, current m2e eclipse plugin. Do you have any ideas? is this a known bug?

kurtseebauer commented 10 years ago

the issue has been brought up on stackoverflow also, but there doesn't seem to be a clear solution to it: http://stackoverflow.com/questions/9818721/wrapping-a-java-command-line-application-with-launch4j-and-maven

lukaszlenart commented 10 years ago

Here is the profile I have been using to packages jar and it works very well.

        <profile>
            <!-- create Windows exe file -->
            <id>izpack</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>antrun</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
                                              toFile="${project.build.directory}/launcher.jar"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.akathist.maven.plugins.launch4j</groupId>
                        <artifactId>launch4j-maven-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>l4j-clui</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>launch4j</goal>
                                </goals>
                                <configuration>
                                    <headerType>gui</headerType>
                                    <jar>${project.build.directory}/${project.artifactId}-${project.version}.jar</jar>
                                    <outfile>${project.build.directory}/launcher.exe</outfile>
                                    <priority>normal</priority>
                                    <downloadUrl>http://java.com/download</downloadUrl>
                                    <supportUrl>http://www.softwaremill.pl/</supportUrl>
                                    <customProcName>true</customProcName>
                                    <stayAlive>false</stayAlive>
                                    <icon>src/main/resources/launcher.ico</icon>
                                    <singleInstance>
                                        <mutexName>CDC-Launcher-Mutex</mutexName>
                                    </singleInstance>
                                    <classPath>
                                        <mainClass>pl.softwaremill.circular.desktop.launcher.Launcher</mainClass>
                                        <preCp>anything</preCp>
                                    </classPath>
                                    <jre>
                                        <minVersion>1.6.0</minVersion>
                                        <jdkPreference>preferJre</jdkPreference>
                                        <opts>
                                            <opt>${allow.self.signed.certificate}</opt>
                                        </opts>
                                    </jre>
                                    <versionInfo>
                                        <fileVersion>1.0.0.0</fileVersion>
                                        <txtFileVersion>${project.version}</txtFileVersion>
                                        <fileDescription>Circular Edit Launcher</fileDescription>
                                        <copyright>SoftwareMill</copyright>
                                        <productVersion>1.0.0.0</productVersion>
                                        <txtProductVersion>${project.parent.version}</txtProductVersion>
                                        <productName>Circular</productName>
                                        <companyName>SoftwareMill</companyName>
                                        <internalName>launcher</internalName>
                                        <originalFilename>launcher.exe</originalFilename>
                                    </versionInfo>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
lukaszlenart commented 10 years ago

It'd be better if you could prepare a sample demo app to demonstrate your problem

lukaszlenart commented 9 years ago

<cp>.</cp> is an invalid option, you can use either preCp or postCp

    /**
     * Part of the classpath that the executable should give to your application.
     * Paths are relative to the executable and should be in Windows format (separated by a semicolon).
     * You don't have to list all your dependencies here; the plugin will include them by default
     * after this list.
     *
     * @parameter
     */
    String preCp;

    /**
     * Part of the classpath that the executable should give to your application.
     * Paths are relative to the executable and should be in Windows format (separated by a semicolon).
     * You don't have to list all your dependencies here; the plugin will include them by default
     * before this list.
     *
     * @parameter
     */
    String postCp;
egor-ryashin commented 8 years ago

BTW, have the same issue right now.

lukaszlenart commented 8 years ago

@egrs more details please :)

kurtseebauer commented 8 years ago

seems like the error message simply indicates that one of the parameters is wrong, pretty misleading. In one case I got it because the icon was not found at the expected location. Better error handling would certainly be a good thing.