0

我正在尝试使用 Proguard 4.8 混淆我在 java 7 中的项目。

这是我的 Maven 插件配置:

            <plugin>
            <groupId>com.pyx4me</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <proguardVersion>4.8</proguardVersion>
                <obfuscate>true</obfuscate>

                <options>
                    <option>-ignorewarnings</option>
                    <option>-dontshrink</option>
                    <option>-dontoptimize</option>
                    <option>-allowaccessmodification</option>
                    <option>-keep class !ua.com.sintez.exceptions.** { *; }</option>
                </options>
                <injar>${project.build.finalName}.jar</injar>
                <outjar>${project.build.finalName}-proguard.jar</outjar>
                <outputDirectory>${project.build.directory}</outputDirectory>
                <libs>
                    <lib>${java.home}/lib/rt.jar</lib>
                    <lib>${java.home}/lib/jsse.jar</lib>
                </libs>
                <addMavenDescriptor>false</addMavenDescriptor>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>net.sf.proguard</groupId>
                    <artifactId>proguard</artifactId>
                    <version>4.8</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </plugin>

我试图混淆只有一个包“ua.com.mycompany.exceptions”,看看它是否有效。该软件包不包含任何有关 JPA 的内容。persistence.xml 就在它的位置,所有实体都在那里。但是当我启动程序时,我收到以下错误:

        The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units.<br/> 
java.lang.IllegalArgumentException: Unknown entity bean class: class ua.com.mycompany.entity.Currency, please verify that this class has been marked with the @Entity annotation.<br/> 
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Problem compiling [select count(p) from Product as p]. 
The abstract schema type 'Product' is unknown.

所以我有以下问题:

  1. 该错误的原因可能是什么?
  2. proguard配置错了吗?
  3. 我也收到了很多这样的:Note: duplicate definition of library class ...和许多这样的警告:Warning:net.sf.jasperreports.compilers.JavaScriptEvaluator: can't find referenced class org.mozilla.javascript.Context
    可以吗,如果可以,我该如何抑制它?
4

0 回答 0