14

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>
Community
  • 1
  • 1
bookhuntress
  • 321
  • 2
  • 12
  • 1
    possible duplicate of [CreateProcess error=206, The filename or extension is too long when running main() method](http://stackoverflow.com/questions/10519558/createprocess-error-206-the-filename-or-extension-is-too-long-when-running-main) – gpapaz Apr 21 '15 at 08:51
  • actually, i've seen that post before i posted my question. the answer 'you can add useexternalfile="yes"' by Brad Mace is not applicable to my case. i'm thinking that at least 1 of the 7 options presented by espinchi can solve my problem but i'm not sure which one. – bookhuntress Apr 21 '15 at 10:54
  • 2
    Then, either update your question to get help to determine which of the 7 options will work for your case, or go to that question and ask on comments? As it is, you are asking the same question as the ones presented as duplicates. – gpapaz Apr 21 '15 at 10:57
  • Have you tried to get more information running maven in debug mode `mvn -X ...`? – SubOptimal Oct 06 '15 at 08:45
  • Are you possible running into the 255 character limit on file path lengths? – Jan Henke Oct 06 '15 at 12:51
  • @JanHenke yes, we have run out of the 255 character limit on file path lengths. however, we cannot correct this due to the naming convention of the plug-ins that we develop. a significant number of these plug-ins are also legacy ones and other teams are using them so we cannot change their names. any suggestions? – bookhuntress Oct 09 '15 at 08:55
  • Compile on a Unix platform, which does not have the 255 character limit. There is no easy way to go around the 255 character limit on Windows. – Jan Henke Oct 09 '15 at 09:37
  • What OS are you using ? – Verhagen Oct 12 '15 at 11:33
  • We are using Windows 7. Since our target users are Windows users only (for now), compiling on a UNIX platform does not make sense for us. – bookhuntress Oct 22 '15 at 16:21

4 Answers4

2

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

srp
  • 619
  • 7
  • 18
1

The reason to that is that generally maven repo is in user’s directory and that path adds on for every jar on the ‘classpath’ which makes it big enough for windows to handle.

The solution is that you need to move your maven repo to a shorter path – say C:. To do that you will need to edit maven settings.xml and add a tag as shown in the image link below. Once you do this, you can run maven clean install. This should solve the issue.

Maven Issue

0

Somehow, for our case, the ff. steps eliminated the error:

  1. Compare the dependencies in the component's pom.xml and the dependencies identified by proguard-maven-plugin. In our case, we noticed that proguard-maven-plugin identified some dependencies that are not really need by the component. In fact, these dependencies are not even specified in the component's pom.xml.

  2. After performing Step 1, modify the component's pom.xml such that it will exclude the unnecessary dependencies that Proguard has identified (i.e., use the exclusion parameter). Below is a sample snippet:

<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>
bookhuntress
  • 321
  • 2
  • 12
0

Apparently this issue was solved in newer versions of the plug-in:

https://github.com/wvengen/proguard-maven-plugin/issues/113

Use this newly added config option, solved our case:

                    <configuration>
                        <generateTemporaryConfigurationFile>true</generateTemporaryConfigurationFile>
                    </configuration>
grimwall
  • 11
  • 2