【问题标题】:.exe is not created when using launch4j and maven使用launch4j和maven时不创建.exe
【发布时间】:2014-08-21 09:11:37
【问题描述】:

我正在尝试使用 launch4jMaven 为我的 JAVA 项目创建一个 exe 文件。

这是我的 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>

我运行:mvn clean compile assembly:single 来创建我的 jar 应用,其中包含所有 Maven 依赖项。

要创建 .exe 我这样做:mvn package 但在目标文件夹下没有创建任何内容。

我是否缺少目标或配置?

伊斯梅尔

【问题讨论】:

  • mvn package:launch4j 为你做点什么吗?
  • 我试过mvn package:laucn4j但我收到了BUILD FAILURE这个消息:No plugin found for prefix package in the current project

标签: java maven exe launch4j


【解决方案1】:

好吧,我不是 maven 专家,但 &lt;pluginManagement&gt; 标签对我来说看起来很可疑。当我得到正确的Maven POM documentation 时,你想要一个普通的&lt;plugins&gt; 元素。

【讨论】:

猜你喜欢
  • 2016-09-14
  • 1970-01-01
  • 1970-01-01
  • 2017-07-20
  • 2015-09-17
  • 2014-08-10
  • 2017-02-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多