Pregunta

Estoy tratando de integrar la generación de un instalador como parte de un proceso de compilación de Maven.

He encontrado el plugin de Alakai para launch4j . He creado una aplicación de Hello Simple World usando Maven. He intentado usar ejemplos de configuración proporcionados por Alakai, pero cuando compile mi proyecto, recibo:

Error al ejecutar la meta org.bluestemSoftware.open.Maven.Plugin: Lanzy4j-Plugin: 1.5.0.0: launch4j (LANZAMIENTO) EN PROYECTO LAIGNO4J: Falló para construir el ejecutable; Por favor verificar su configuración Tarro de aplicación no existe. -> [Ayuda 1]

Desafortunadamente, la documentación de Alakai es limitada y no pude encontrar mucho con Google.

  • ¿Alguien sabe dónde se debe configurar el lanzamiento config.xml? ¿Está dentro del proyecto? ¿Está en un directorio separado?
  • ¿Necesito usar el complemento de ensamblaje?
  • He instalado launch4j en mi PC. ¿Necesito especificar el directorio de instalación en mi POM.XML? Si es así, ¿cómo?
  • ¿Alguien tiene una muestra de POM.XML operacional / ejemplo para compartir?

    gracias.

¿Fue útil?

Solución

  1. There's no config.xml, you need to configure launch4j inside your pom.xml file.
  2. You could use maven-assembly-plugin, but I recommend you to use maven-shade-plugin.
  3. Don't need to specify launch4j installation, this plugin works 100% maven.
  4. Sure. Follows the shade and launch4j configs I use, that generates two exes, one console and one gui, using different main classes:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <shadedArtifactAttached>true</shadedArtifactAttached> <!-- Make the shaded artifact not the main one -->
        <shadedClassifierName>shaded</shadedClassifierName> <!-- set the suffix to the shaded jar -->
    </configuration>
</plugin>

<plugin>
    <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
    <artifactId>launch4j-plugin</artifactId>
    <version>1.5.0.0</version>
    <executions>

        <!-- GUI exe -->
        <execution>
            <id>l4j-gui</id>
            <phase>package</phase>
            <goals>
                <goal>launch4j</goal>
            </goals>
            <configuration>
                <headerType>gui</headerType>
                <outfile>target/app-gui.exe</outfile>
                <jar>target/${artifactId}-${version}-shaded.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
                <errTitle>App Err</errTitle>
                <classPath>
                    <mainClass>package.AppGUI</mainClass>
                </classPath>
                <icon>src/main/resources/icons/exeIcon.ico</icon>
                <jre>
                    <minVersion>1.5.0</minVersion>
                    <maxVersion>1.6.0</maxVersion>
                    <initialHeapSize>128</initialHeapSize>
                    <maxHeapSize>1024</maxHeapSize>
                </jre>
                <versionInfo>
                    <fileVersion>1.0.0.0</fileVersion>
                    <txtFileVersion>1.0.0.0</txtFileVersion>
                    <fileDescription>Desc</fileDescription>
                    <copyright>C</copyright>
                    <productVersion>1.0.0.0</productVersion>
                    <txtProductVersion>1.0.0.0</txtProductVersion>
                    <productName>Product</productName>
                    <internalName>Product</internalName>
                    <originalFilename>App.exe</originalFilename>
                </versionInfo>
            </configuration>
        </execution>

        <!-- Command-line exe -->
        <execution>
            <id>l4j-cli</id>
            <phase>package</phase>
            <goals>
                <goal>launch4j</goal>
            </goals>
            <configuration>
                <headerType>console</headerType>
                <outfile>target/app-cli.exe</outfile>
                <jar>target/${artifactId}-${version}-shaded.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
                <errTitle>App Err</errTitle>
                <classPath>
                    <mainClass>package.AppCLI</mainClass>
                </classPath>
                <icon>src/main/resources/icons/exeIcon.ico</icon>
                <jre>
                    <minVersion>1.5.0</minVersion>
                    <maxVersion>1.6.0</maxVersion>
                    <initialHeapSize>128</initialHeapSize>
                    <maxHeapSize>1024</maxHeapSize>
                </jre>
            </configuration>
        </execution>
    </executions>
</plugin>

Alternatively, You can omit the 'jar' tag on launch4j-plugin and remove the extra configs of the shade-plugin, but be aware that this will replace the main jar of the flow (without embedded dependencies) by the shaded jar (with embedded dependencies), and this one will be installed on your local repo, or used in the reactor if needed.

Otros consejos

For how to define the main class for the shade plugin, see http://maven.apache.org/plugins/maven-shade-plugin/examples/executable-jar.html.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top