Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When executing proguard-maven-plugin, "CreateProcess error=206, The filename or extension is too long" occurs

We are developing our own Eclipse plugin jars used by our Eclipse-based application. We are currently using proguard-maven-plugin version 2.0.8 to obfuscate them. However, when running mvn install on some plugins, we are currently encountering the following error:

[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]

Has anyone ever encountered this? If so, how did you solve the problem?

Note that I have actually seen this question and other related questions before deciding to ask but the answer by Brad Mace is not applicable to my case as the "CreateProcess error=206, The filename or extension is too long" is generated by Proguard and not by Javadoc. Initially, I think (correct me if I'm wrong) that either 1 of the 7 options given by espinchi or a variation of them might work but I'm not sure which one. Just to let you know my constraints in determining the solution:

  1. I'm not sure if all of the classpaths in this particular plugin are valid since this has been developed by someone else many, many years ago so I don't think I can still contact the developer. This makes me hesitant to reduce the classpaths for fear that it might actually do more harm than good.
  2. I cannot use the switch to "use IntelliJ" option since this problem occurred on the Windows command line when doing mvn install and not in Eclipse IDE.
  3. I think the other options are too tedious for me. I'm hoping there's a simpler solution.

For reference, below is the Proguard-related snippet from my pom file:

<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>
like image 759
bookhuntress Avatar asked Apr 21 '15 08:04

bookhuntress


1 Answers

If you have a huge list of dependencies the list of -libraryjars the resulting command line to execute ProGaurd could become too long. On Windows the error message could look like CreateProcess error=206, The filename or extension is too long.

<putLibraryJarsInTempDir>true</putLibraryJarsInTempDir>

in plugin configuration makes the plugin copy all the library jars to a single temporary directory and pass that directory as the only -libraryjars argument to ProGuard. Build performance will be a bit worse, but the command line will be much shorter.

for detailed information about proguard maven plugin usage please refer their here

like image 84
srp Avatar answered Oct 06 '22 00:10

srp