在企业Java应用程序上进行Proguard配置 [英] Proguard configuration on a Enterprise Java Application

查看:501
本文介绍了在企业Java应用程序上进行Proguard配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Maven项目中使用proguard,这是一个模糊的插件,当我运行它时出现错误:

I'm trying to use proguard in a Maven project this is a obfuscate plugin, when I run it I have an error:

在项目MavenEnterpriseApp-ear上无法执行目标com.pyx4me:proguard-maven-plugin:2.0.4:proguard(默认):混淆失败(结果= 1)-> [帮助1]

当我使用-e或-X运行maven时,我有:

when I run maven with -e or -X I have:

org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目MavenEnterpriseApp-ear上执行目标com.pyx4me:proguard-maven-plugin:2.0.4:proguard(默认值):混淆失败(结果= 1 ) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 在org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 在org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 在org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) 在org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.pyx4me:proguard-maven-plugin:2.0.4:proguard (default) on project MavenEnterpriseApp-ear: Obfuscation failed (result=1) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

我的插件配置为:

<plugin>
    <groupId>com.pyx4me</groupId>
    <artifactId>proguard-maven-plugin</artifactId>
    <version>2.0.4</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>proguard</goal>
            </goals>
        </execution>
    </executions>               
    <configuration>
        <obfuscate>true</obfuscate>
        <includeDependency>false</includeDependency> 
        <injar>${project.artifactId}-v${project.version}.ear</injar>
        <outjar>${project.artifactId}-v${project.version}-obf.ear</outjar> 
        <outputDirectory>${project.build.directory}</outputDirectory> 
        <maxMemory>256m</maxMemory>

    </configuration>
   </plugin>

正如您所看到的,我正在努力取消耳朵的耳朵.在官方页面中:

As you can see I'm trying to ofuscate the ear. In the official page:

罐子:指定输入罐子的名称(或战争, 耳朵 ,邮编) 待处理的申请.您可以指定一个类目录,例如 班级".这样,插件将处理类而不是jar. 您将需要将执行绑定到阶段编译"或 在这种情况下为过程类".

injar: Specifies the input jar name (or wars, ears, zips) of the application to be processed. You may specify a classes directory e.g. 'classes'. This way plugin will processed the classes instead of jar. You would need to bind the execution to phase 'compile' or 'process-classes' in this case.

该项目是一个Maven Enterise Application项目,基本上我有2个子项目,一个具有JPA和EJB3资源,另一个是具有jsf结构的Web项目.当我运行Maven时,我会听到一个耳朵,在这个耳朵中,我有2个二进制文件,一个jar和一个war.我有三个 问题:

The project is an a Maven Enterise Application project, basically I have 2 sub project one with JPA and EJB3 resources and the other is an a web project with jsf the structure is. When I run Maven I obtain an ear, in this I have 2 binaries a jar and a war. I have three questions:

首先)我想在什么pom中插入它?现在,如您所见,我将pom用于EAR项目:

First) In what pom I suppose to insert it? now I'm using the pom into the EAR project as you can see:

第二)我可以迷惑耳朵吗?

Second)I can obfuscatean an ear?

第三)如果第二个是错误的:我该如何迷惑耳朵?我正在尝试指定罐子,但是我遇到了同样的错误:

Third) If the second is false: how can I obfuscate specificlly the ears? I'm trying to specify the jars but I recive the same error ever:

在项目MavenEnterpriseApp-ear上无法执行目标com.pyx4me:proguard-maven-plugin:2.0.4:proguard(默认):混淆失败(结果= 1)-> [帮助1]

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

推荐答案

尝试将proguard的阶段从"prepare-package"更改为"process-classes",将injar选项更改为"classes",让我知道是否不起作用.

Try to change phase of proguard from "prepare-package" into "process-classes", change injar option into "classes", and let me know if it does not work.

HTH.

这篇关于在企业Java应用程序上进行Proguard配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆