pom中无法识别shortFileNames
时间: 2023-11-25 22:06:11 浏览: 38
如果在 pom.xml 中无法识别 `shortFileNames` 参数,可能是因为使用的 ProGuard Maven 插件版本比较旧,该参数还未被支持。请尝试更新 ProGuard Maven 插件版本到最新版,目前最新版本为 2.6.0,更新方式如下:
```xml
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.6.0</version>
...
</plugin>
```
如果更新版本后仍然无法识别 `shortFileNames` 参数,可以尝试使用 `-optimizations` 选项中的 `class/field/method` 参数来启用文件名缩短功能,例如:
```xml
<configuration>
<proguardVersion>6.2.2</proguardVersion>
<options>
<option>-optimizations class/field/method</option>
</options>
</configuration>
```
这样可以启用 ProGuard 的基本优化,包括文件名缩短功能。但需要注意的是,缩短文件名可能会导致一些潜在的问题,例如使用反射或者动态生成类等情况,可能会出现类名或方法名无法正确识别的问题。因此,在启用文件名缩短功能时,需要根据具体情况进行测试和调试,确保代码能够正常运行。