English 中文(简体)
卫士说,找不到任何班级。
原标题:Proguard is saying it can t find any classes

I m 采用guard锁,并使用 spring子。

My pom.xml s Building section see such as:

<build>
        <finalName>myapp</finalName>
        <plugins>
           <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <obfuscate>true</obfuscate>
                    <!--<options>-->
                        <!--<option>-keep public class</option>-->
                    <!--</options>-->
                    <injar>${project.build.finalName}</injar>
                    <injar>${project.build.finalName}</injar>
                    <inFilter>com.myapp.*</inFilter>
                </configuration>
            </plugin>
         </plugins>

我还努力:

<injar>${project.build.finalName}.war</injar>

When I run:

mvn clean install

发出失败信息:

[proguard] Reading program war [/Users/me/dev/git/myproject/myapp/target/myapp.war] (filtered)
 [proguard] Error: The input doesn t contain any classes. Did you specify the proper  -injars  options?

ERROR] Failed to execute goal com.pyx4me:proguard-maven-plugin:2.0.4:proguard (default) on project myapp: Obfuscation failed (result=1) -> [Help 1]

看来,正如前面的信息显示的那样,我已经正确地走过了这句jar:

[INFO] --- proguard-maven-plugin:2.0.4:proguard (default) @ myapp ---
[INFO] execute ProGuard [-injars,  /Users/me/dev/gitserver/myproject/myapp/target/myapp.war (!META-INF/maven/**,com.myapp.*), -outjars,  /Users/me/dev/git/myproject/myapp/target/myapp_pg.war , -libraryjars, ....

www.un.org/Depts/DGACM/index_spanish.htm 另外,你建议我使用哪些选择? 这是一个春天,因此,我的发言如下:

  1. @Autowired
  2. @Service
  3. @Repository
  4. @Controller

因此,这些类别/领域不应改名为我想象的。

(我们的目的只是要把它当作一个 head头,让那些不相干的人坐下来,这样他们就能够 just倒,使用法典。 混淆将使他们能够使用该数据库,但除非他们重新使用该数据库,否则他们就能够维持该数据库。 我没有任何算法,因此我在这方面没有任何真实的藏匿之处。

请允许我在此明确表明,我春天在做一只冲洗装置时,出于某种原因使用ven(一只新到黑夜)会产生我的app。 战争档案和战争爆炸(这是我想要在生产中部署的,而不是我的app。)

My myapp folder has:

/target/myapp/
/target/myapp/meta-inf (empty folder)
/target/myapp/web-inf
/target/myapp/web-inf/classes (com.myapp. ...)
/target/myapp/web-inf/lib/
/target/myapp/web-inf/ web.xml, application.xml (for spring)
/target/myapp/web-inf/views/

So proguard should be obfuscating in the /target/myapp/web-inf/classes folder right? How do I tell it to do so?

我现在想到:

我没有忘记:没有执行目标......保障。 Can t 更名为/Users/me/dev/git/project1/myapp/target/myapp/web-inf/classes(见我关于我下午改动的一节)。

我用以下文字修改了我的om:

            <configuration>
                <obfuscate>true</obfuscate>

                <injar>${project.build.finalName}/WEB-INF/classes/</injar>
                <inFilter>com/myapp/**</inFilter>
            </configuration>
问题回答

ProGuard filters work on file names, so

.....(!META-INF/maven/**,com.myapp.*)

也许会赢得与任何阶级档案相匹配的笔。 你们可能希望

.....(!META-INF/maven/**,com/myapp/**)

您能够把整个时间排在后面。

通常,Maven汇编到/目标/类别(为WAR文档提供电子数据),而WAR的原始图象在一揽子计划阶段之前就将复制到网上。 您应为:not,以人工方式汇编与Maven的网络/校准课程。

EDIT:科索沃已经做了相当一部分研究,但我已经找到了答案。 第一,,根据ProGuard文件,你不应在战争项目中开设ANY:

Notably, class files that are in the WEB-INF/classes directory in a war should be packaged in a jar and put in the WEB-INF/lib directory

你们需要重新支持你们的项目,这样你的网站就在一个单独的支柱中建立。 一旦你建造了这一杰尔项目,你就必须在你的战争项目中增加它。

Once I created that setup, I was successfully able to build a war project with the following configuration:

<build>
        <plugins>
            <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <inFilter>com/example/**</inFilter>
                    <libs>
                        <lib>${java.home}/lib/rt.jar</lib>
                        <lib>${java.home}/lib/jsse.jar</lib>
                    </libs>
                    <options>
                        <option>-keep class com.example.echo.EchoServlet</option>
                        <option>-injar ${project.build.directory}/${project.build.finalName}.${project.packaging}</option>
                        <option>-outjar ${project.build.directory}/${project.build.finalName}-proguarded.${project.packaging}</option>
                    </options>
                </configuration>
            </plugin>
        </plugins>
    </build>

注 “com.example.echo.EchoServlet”。 由于赞成改变我的班子名称,我不得不“保留”这一保留名称,因此,我可以在WAR项目网上查阅。 如果你使用以电灯为基础的电灯组合,我就认为,这是必要的。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签