.exe is not created when using launch4j and maven

Posted by Ismail Sen on Stack Overflow See other posts from Stack Overflow or by Ismail Sen
Published on 2014-08-21T09:11:37Z Indexed on 2014/08/21 10:20 UTC
Read the original article Hit count: 395

Filed under:
|
|
|

I'm trying to create an exe file for my JAVA project using launch4j and Maven.

Here is my pom.xml

 <build>
    <pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <descriptorRefs>
                    <descriptortRef>jar-with-dependencies</descriptortRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>dev.main.App</mainClass>
                    </manifest> 
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.7.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>shaded</shadedClassifierName>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>dev.main.App</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.5.1</version>
            <executions>
                <execution>
                    <id>l4j-clui</id>
                    <phase>package</phase>
                    <goals>
                        <goal>launch4j</goal>
                    </goals>
                    <configuration>
                        <headerType>console</headerType>
                        <jar>${project.build.directory}/target/App-jar-with-dependencies.jar</jar>
                        <outfile>${project.build.directory}/target/App.exe</outfile>
                        <downloadUrl>http://java.com/download</downloadUrl>
                        <classPath>
                            <mainClass>dev.main.App</mainClass>
                        </classPath>
                        <jre>
                            <minVersion>1.6.0</minVersion>
                            <jdkPreference>preferJre</jdkPreference>
                        </jre>
                        <versionInfo>
                            <fileVersion>1.0.0.0</fileVersion>
                            <txtFileVersion>${project.version}</txtFileVersion>
                            <fileDescription>${project.name}</fileDescription>
                            <copyright>C</copyright>
                            <productVersion>1.0.0.0</productVersion>
                            <txtProductVersion>1.0.0.0</txtProductVersion>
                            <productName>${project.name}</productName>
                            <internalName>AppName</internalName>
                            <originalFilename>App.exe</originalFilename>
                        </versionInfo>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
   </pluginManagement>
</build>

I run : mvn clean compile assembly:single to create my jar app with all Maven dependencies.

To create the .exe I do : mvn package but nothing is created under target folder.

Am I missing a goal or a configuration ?

Ismail

© Stack Overflow or respective owner

Related posts about java

Related posts about maven