Issue
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:
- 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.
- 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.
- 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>
Solution
Somehow, for our case, the ff. steps eliminated the error:
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.
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>
Answered By - bookhuntress
Answer Checked By - David Goodson (JavaFixing Volunteer)