代码之家  ›  专栏  ›  技术社区  ›  Ismail Sen

使用launch4j和maven时不会创建.exe

  •  0
  • Ismail Sen  · 技术社区  · 11 年前

    我正在尝试为我的 JAVA 项目使用 发射4j 专家 .

    这是我的 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 创建我的 罐子 所有Maven依赖项。

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

    我是否错过了目标或配置?

    伊斯梅尔

    1 回复  |  直到 11 年前
        1
  •  1
  •   Flo    11 年前

    嗯,我不是maven的专家,但 <pluginManagement> 标签看起来很可疑。当我拿到 Maven POM documentation 好的,你想要一份普通的 <plugins> 要素

    推荐文章