proguard注意:库类[javax.annotation.PostConstruct]的重复定义

时间:2018-08-17 11:26:27

标签: java spring-boot proguard

我尝试在Spring Boot App上启动ProGuard并收到错误消息:

  [proguard] Reading library jar [C:\Program Files\Java\jdk1.8.0_151\jre\lib\rt.jar]
     [proguard] Note: duplicate definition of library class [javax.annotation.Generated]
     [proguard] Note: duplicate definition of library class [javax.annotation.PostConstruct]
     [proguard] Note: duplicate definition of library class [javax.annotation.PreDestroy]
     [proguard] Note: duplicate definition of library class [javax.annotation.Resource$AuthenticationType]
     [proguard] Note: duplicate definition of library class [javax.annotation.Resource]
     [proguard] Note: duplicate definition of library class [javax.annotation.Resources]
     [proguard] Note: there were 8 duplicate class definitions.
     [proguard]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
     [proguard] Warning: there were 2 classes in incorrectly named files.
     [proguard]          You should make sure all file names correspond to their class names.
     [proguard]          The directory hierarchies must correspond to the package hierarchies.
     [proguard]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
     [proguard]          If you don't mind the mentioned classes not being written out,
     [proguard]          you could try your luck using the '-ignorewarnings' option.
     [proguard] Error: Please correct the above warnings first.

为什么会出现此错误以及如何解决?

2 个答案:

答案 0 :(得分:1)

您可以执行以下操作来摆脱这种情况:

  1. 如果添加了proguard选项-printconfiguration configuration.txt,您将看到所有proguard添加的内容。
  2. 根据您从以上步骤中获得的信息,您可以更正相同的内容

OR

您可以使用以下选项停止查看这些警告消息:文档here

-dontwarn javax.annotation.*
-dontnote javax.annotation.*

请查看this问题,以获取有关您当前所面临情况的更多详细信息。

答案 1 :(得分:0)

尝试忽略类public function writePage() { if(!$this->header){ $this->SetHeaderMargin(0); } else{ $this->SetHeaderMargin(5); } if(!$this->footer){ $this->SetFooterMargin(0); } else{ $this->SetFooterMargin(21); } $this->setMargins(10, 40, 10); $this->AddPage(); $this->writeHTML($this->content, true, false, true, false, ''); }

并阅读更多: https://www.guardsquare.com/en/products/proguard/manual/troubleshooting#duplicateclass