执行proguard-maven-plugin时,会出现"CreateProcess error = 206,文件名或扩展名太长"

boo*_*ess 13 java eclipse proguard maven

我们正在开发我们自己的基于Eclipse的应用程序使用的Eclipse插件jar.我们目前正在使用proguard-maven-plugin2.0.8版来混淆它们.但是,mvn install在某些插件上运行时,我们当前遇到以下错误:

[INFO] ---------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
[INFO] Total time: 1:34.297s
[INFO] Finished at: Tue Apr 21 16:03:51 SGT 2015
[INFO] Final Memory: 88M/210M
[INFO] ---------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.wvengen:proguard-maven-plugin:2.0.8:proguard (default) on project com.x.y: Execution default of goal com.github.wvengen:proguard-maven-plugin:2.0.8:proguard failed: java.io.IOException: Cannot run program "C:\Program Files (x86)\Java\jdk1.7.0_55\jre\bin\java.exe": CreateProcess error=206, The filename or extension is too long -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

有没有人见过这个?如果是这样,你是如何解决这个问题的?

请注意,在决定询问之前我实际上已经看过这个问题和其他相关问题,但Brad Mace的答案不适用于我的情况,因为"CreateProcess error = 206,文件名或扩展名太长"是由Proguard生成的而不是由贾瓦多克.最初,我认为(纠正我,如果我错了)espinchi给出的7个选项中的任何一个或者它们的变体可能有效,但我不确定是哪一个.只是为了让您了解我在确定解决方案时遇到的限制:

  1. 我不确定这个特定插件中的所有类路径是否都有效,因为很多年前很多人都开发过它,所以我不认为我仍然可以联系开发人员.这让我对减少类路径犹豫不决,因为担心它实际上可能弊大于利.
  2. 我无法使用该开关"使用IntelliJ"选项,因为在执行mvn安装时而不是在Eclipse IDE中,Windows命令行中出现此问题.
  3. 我认为其他选择对我来说太乏味了.我希望有一个更简单的解决方案.

作为参考,下面是我的pom文件中与Proguard相关的片段:

<build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <maxMemory>1024m</maxMemory>
                <proguardInclude>${basedir}/proguard.conf</proguardInclude>
                <libs>
                    <lib>${java.home}/lib/rt.jar</lib>
                </libs>
                <exclusions>
                    <exclusion>
                        <groupId>com.company.package</groupId>
                    </exclusion>
                </exclusions>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

boo*_*ess 0

不知何故,对于我们的情况,ff。步骤消除了错误:

  1. 比较组件的 pom.xml 中的依赖关系和 proguard-maven-plugin 标识的依赖关系。在我们的例子中,我们注意到 proguard-maven-plugin 识别了一些组件并不真正需要的依赖项。事实上,这些依赖关系甚至没有在组件的 pom.xml 中指定。

  2. 执行步骤1后,修改组件的pom.xml,以便排除Proguard已识别的不必要的依赖项(即使用exclusion参数)。下面是一个示例片段:

<build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <version>2.0.10</version>
            <executions>
                <execution>
                    <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                </execution>
            </executions>
            <configuration>
                <maxMemory>1024m</maxMemory>
                <proguardInclude>${basedir}/proguard.conf</proguardInclude>
                <libs>
                    <lib>${java.home}/lib/rt.jar</lib>
                    <lib>${java.home}/lib/jce.jar</lib>
                </libs>
                <!-- For some reason, these components are included by the plugin even if they are not dependencies of SES components so we need to explicitly indicate to proguard-maven-plugin to exclude them. -->
                <exclusions>
                    <exclusion>
                        <groupId>p2.eclipse-plugin</groupId>
                        <artifactId>org.apache.geronimo.specs.geronimo-jms_1.1_spec</artifactId>
                    </exclusion>
                    <!-- other exclusions here -->
                </exclusions>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>net.sf.proguard</groupId>
                    <artifactId>proguard-base</artifactId>
                    <version>5.2</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)