Launch4J 플러그인 (JAR와 함께) EXE 파일을 생성하지만, EXE 봄 부팅 주요 클래스를 찾을 수 없습니다

Prateek 나렌드라 :

내가 Launch4J 플러그인의 도움으로 내 프로젝트에 대한 EXE 파일을 만들 수있는 플러그인 및 JAR을 썼다. 그러나, EXE 파일을 실행에, 나는 오류 -

Error: Could not find or load main class

그러나, 나는 제공함으로써 JAR를 실행 java -jar app.jar, 그것은 완벽하게 실행됩니다.

이것은 내 플러그인 섹션

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.mycompany.tool.orchestrator.command.CommandHandler</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.akathist.maven.plugins.launch4j</groupId>
                <artifactId>launch4j-maven-plugin</artifactId>
                <version>1.7.16</version>
                <executions>
                    <execution>
                        <id>l4j-clui</id>
                        <phase>package</phase>
                        <goals>
                            <goal>launch4j</goal>
                        </goals>
                        <configuration>
                            <headerType>console</headerType>
                            <outfile>target/apidast.exe</outfile>
                            <jar>${project.build.directory}/${artifactId}-${version}.jar</jar>
                            <errTitle>encc</errTitle>
                            <classPath>
                                <mainClass>com.mycompany.tool.orchestrator.command.CommandHandler</mainClass>
                                <!--Not sure what the next 2 lines are for -->
                                <addDependencies>true</addDependencies>
                                <preCp>anything</preCp>
                            </classPath>
                            <jre>
                                <minVersion>1.8.0_212</minVersion>
                                <!--Not sure what these opts are for -->
                                <opts>
                                    <opt>-Djava.endorsed.dirs=./endorsed</opt>
                                </opts>
                            </jre>
                            <versionInfo>
                                <fileVersion>0.0.1.0</fileVersion>
                                <txtFileVersion>0.0.1.0</txtFileVersion>
                                <fileDescription>${project.name}</fileDescription>
                                <copyright>My Company.</copyright>
                                <productVersion>0.0.1.0</productVersion>
                                <txtProductVersion>${version}</txtProductVersion>
                                <productName>${project.name}</productName>
                                <originalFilename>apidast.exe</originalFilename>
                                <!-- internalName is mandatory -->
                                <internalName>apidast</internalName>
                            </versionInfo>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

EXE 파일 내 대상 폴더에 존재한다. 이 메인 클래스를 찾을 수 없습니다라고하지만 나는 (플러그인 세부 사항을 추가에도 불구하고)를 실행할 수 없습니다

sambit :

어떤 Maven 프로젝트에 대해 다음 명령을 사용하여 받는다는 빌드를 TUN보십시오.

MVN 깨끗한 패키지 또는 MVN 클린 설치

Launch4j과 관련하여, 다음과 같은 명령을 실행해야합니다.

MVN 깨끗한 패키지

Launch4j에 대한 자세한 내용은, 당신은 아래 링크를 확인하실 수 있습니다. https://github.com/lukaszlenart/launch4j-maven-plugin/blob/master/src/main/resources/README.adoc

그러나이 프로젝트에, 나는 당신이 봄 부팅을 사용하는 참조하십시오. 내 이해가 정확하면 봄 부팅에서 EXE 파일을 만들려고합니다. 만일이 경우라면.

당신은 launch4j 및 검사에 대한 변경 아래를 사용하려고 할 수 있습니다.

<classPath>                    
   <mainClass>org.springframework.boot.loader.JarLauncher</mainClass>                                
   <addDependencies>true</addDependencies>
   <preCp>anything</preCp>
</classPath>

추천

출처http://43.154.161.224:23101/article/api/json?id=238883&siteId=1