我们正在开发基于Eclipse的应用程序使用的自己的Eclipse插件jars。我们目前正在使用proguard-maven-plugin
版本2.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]
有人遇到过这种情况吗?如果是的话,你是如何解决这个问题的?
请注意,在决定问之前,我确实看过这个问题和其他相关的问题,但是Brad的回答不适用于我的情况,因为"CreateProcess error=206,文件名或扩展名太长“是由Proguard而不是由Javadoc生成的。最初,我认为(如果我错了就纠正我),无论是由espinchi给出的7种选择中的一种,还是其中的一种,都可能有效,但我不确定哪一种可行。为了让您知道我在确定解决方案时的限制:
作为参考,下面是我的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>
发布于 2015-10-22 16:30:29
不知怎么的,对我们的案子来说。消除错误的步骤:
<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>
发布于 2018-03-14 06:29:09
如果您有一个庞大的依赖项列表,那么-libraryjars的列表(执行ProGaurd的命令行)可能会变得太长。在Windows上,错误消息可能看起来像CreateProcess error=206,文件名或扩展名太长了。
<putLibraryJarsInTempDir>true</putLibraryJarsInTempDir>
在插件配置中,插件将所有库jars复制到一个临时目录,并将该目录作为唯一的-libraryjars参数传递给ProGuard。构建性能会更差,但是命令行会更短。
如需有关proguard插件使用的详细信息,请参阅它们的这里。
发布于 2019-05-24 08:28:55
这样做的原因是,通常maven repo位于用户目录中,该路径会为“类路径”上的每个jar添加一个路径,从而使其足够大,供windows处理。
解决方案是,您需要将您的maven回购移到一个更短的路径上,例如C:。要做到这一点,您需要编辑maven settings.xml并添加一个标记,如下面的图像链接所示。一旦您这样做,您可以运行maven干净安装。这应该能解决这个问题。
https://stackoverflow.com/questions/29767073
复制相似问题