【问题标题】:How to run proguard in my spring mvc application, no jar but for classes?如何在我的 spring mvc 应用程序中运行 proguard,除了类之外没有 jar?
【发布时间】:2012-01-11 04:51:37
【问题描述】:

Spring mvc 应用程序没有 jar,它们有战争(.war 或爆炸)。

我的 maven 构建在:

/myapp/target/myapp-1.0/

我的课程在:

/myapp/target/myapp-1.0/web-inf/classes

我想混淆命名空间 com.maypp.* 中的所有内容

我该怎么做?

到目前为止,我有这个:

 <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>
                <injar>?????</injar>
                <inFilter>com.myapp.*</inFilter>
            </configuration>
        </plugin>

P.S 我在教程中看到这些选项,它们在做什么?

<options>
16.
<option>-allowaccessmodification</option>
17.
<option>-keep public class
18.
${project.build.mainClass} { *; }</option>
19.
</options>

【问题讨论】:

  • 不,我的包装是一场爆炸战争
  • 那么你想混淆什么?
  • 我想混淆我的 /target/myapp-1.0/web-inf/classes (.class 文件,这是一个 Web 应用程序,所以我的 maven 构建会产生爆炸性的战争)。

标签: java spring maven proguard


【解决方案1】:

ant task docs 中所述,injar 标签:

指定程序 jars(或 war、ears、zip 或目录)。

另外:

jar 标记是路径标记,因此它们可以具有任何路径属性(或嵌套元素)。最常见的属性是 [一堆属性,如"path"]。

【讨论】:

  • 我现在有这个,但仍然找不到类,在 mvn clean install 期间出错:Error: The input doesn't contain any classes. Did you specify the proper '-injars' options? my pom.xml has &lt;injar&gt;${project.build.finalName}.war&lt;/injar&gt;
  • 应该是我的 .war 文件名,myapp.war(我假设它是)在运行 mvn clean install 时,它显示 proguard -injars /path/to/myapp/target/myapp.war (!META-INF/maven/**,com.myapp.*)
猜你喜欢
  • 2018-08-18
  • 1970-01-01
  • 2019-05-28
  • 1970-01-01
  • 2023-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-02
相关资源
最近更新 更多