【问题标题】:proguard Note: duplicate definition of library class [javax.annotation.PostConstruct]proguard 注意:库类的重复定义 [javax.annotation.PostConstruct]
【发布时间】:2019-01-24 10:31:18
【问题描述】:

我尝试在 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.

为什么我会收到此错误,我该如何解决?

【问题讨论】:

    标签: java spring-boot proguard


    【解决方案1】:

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

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

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

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

    请查看this 问题以了解有关您现在所面临情况的更多详细信息。

    【讨论】:

      【解决方案2】:

      尝试忽略类-dontnote javax.annotation.*

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

      【讨论】:

        猜你喜欢
        • 2016-01-07
        • 2012-01-14
        • 1970-01-01
        • 2012-10-31
        • 2012-02-07
        • 2016-02-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多