我做了一个应用程序弹簧启动,我使用maven。我也想混淆代码。我在专业卫士插件的帮助下做到这一点。这是pom.xml的代码:
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>proguard</goal></goals>
</execution>
</executions>
<configuration>
<proguardVersion>6.0beta1</proguardVersion>
<injar>${project.build.finalName}.jar</injar>
<outjar>${project.build.finalName}.jar</outjar>
<obfuscate>true</obfuscate>
<proguardInclude>${basedir}/proguard.conf</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
<lib>${java.home}/lib/jce.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>6.0beta1</version>
<scope>system</scope> <systemPath>${basedir}/src/main/resources/libs/proguard/proguard.jar</systemPath>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<mainClass>com.dfd.Application</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
这是我的 proguard.conf 文件:
#-injars BOOT-INFlib
#-injars BOOT-INFclasses
-libraryjars 'C:Program FilesJavajre1.8.0_201librt.jar'
-keepdirectories
-dontshrink
-dontoptimize
-dontobfuscate
-obfuscationdictionary 'obfuc.txt'
-classobfuscationdictionary 'obfuc.txt'
-packageobfuscationdictionary 'obfuc.txt'
-dontnote
-ignorewarnings
# Keep - Applications. Keep all application classes, along with their 'main' methods.
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
# Also keep - Enumerations. Keep the special static methods that are required in
# enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Also keep - Database drivers. Keep all implementations of java.sql.Driver.
-keep class * extends java.sql.Driver
# Also keep - Swing UI L&F. Keep all extensions of javax.swing.plaf.ComponentUI,
# along with the special 'createUI' method.
-keep class * extends javax.swing.plaf.ComponentUI {
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent);
}
# Keep - Native method names. Keep all native class/method names.
-keepclasseswithmembers,includedescriptorclasses,allowshrinking class * {
native <methods>;
}
我正在尝试在Intellegi Idea中构建一个jar文件,但是我收到了很多错误。结果,生成的 jar 没有通过混淆。我做错了什么,如何使混淆得到满足?谢谢。
日志:
[proguard] ProGuard, version 6.0.3
[proguard] Reading program jar [D:Yandex.DiskYandexDiskprogrammingintellegi_ideadfd-editor-projectsdfd-editor-v0.4targetdfd-editor_proguard_base.jar] (filtered)
[proguard] Warning: class [BOOT-INF/classes/com/dfd/Application.class] unexpectedly contains class [com.dfd.Application]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/GeneratorCode$1.class] unexpectedly contains class [com.dfd.logic.GeneratorCode$1]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/COutput.class] unexpectedly contains class [com.dfd.model.blocks.cells.COutput]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/factory/CInputCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.factory.CInputCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/maincreator/CellCreator$1.class] unexpectedly contains class [com.dfd.model.blocks.cells.maincreator.CellCreator$1]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/parsed/CellConstantsCreator.class] unexpectedly contains class [com.dfd.model.blocks.parsed.CellConstantsCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/collections/SpecialList.class] unexpectedly contains class [com.dfd.model.collections.SpecialList]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/generator/code/ClassGenerator.class] unexpectedly contains class [com.dfd.logic.generator.code.ClassGenerator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/generator/code/Method.class] unexpectedly contains class [com.dfd.logic.generator.code.Method]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/generator/code/Pair.class] unexpectedly contains class [com.dfd.logic.generator.code.Pair]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/CInput.class] unexpectedly contains class [com.dfd.model.blocks.cells.CInput]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/factory/CCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.factory.CCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/factory/CTempDatabaseCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.factory.CTempDatabaseCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/collections/comparators/LineComparator.class] unexpectedly contains class [com.dfd.model.collections.comparators.LineComparator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/generator/code/GeneralGenerator.class] unexpectedly contains class [com.dfd.logic.generator.code.GeneralGenerator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/generator/code/InterfaceGenerator.class] unexpectedly contains class [com.dfd.logic.generator.code.InterfaceGenerator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/Cell.class] unexpectedly contains class [com.dfd.model.blocks.cells.Cell]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/CProcess.class] unexpectedly contains class [com.dfd.model.blocks.cells.CProcess]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/factory/COutputCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.factory.COutputCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/maincreator/CellCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.maincreator.CellCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/parsed/CellText.class] unexpectedly contains class [com.dfd.model.blocks.parsed.CellText]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/entity/Diagram.class] unexpectedly contains class [com.dfd.model.entity.Diagram]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/controller/DfdController.class] unexpectedly contains class [com.dfd.controller.DfdController]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/logic/GeneratorCode.class] unexpectedly contains class [com.dfd.logic.GeneratorCode]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/CTempDatabase.class] unexpectedly contains class [com.dfd.model.blocks.cells.CTempDatabase]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/cells/factory/CProcessCreator.class] unexpectedly contains class [com.dfd.model.blocks.cells.factory.CProcessCreator]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/Line.class] unexpectedly contains class [com.dfd.model.blocks.Line]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/blocks/parsed/CellConstants.class] unexpectedly contains class [com.dfd.model.blocks.parsed.CellConstants]
[proguard] Warning: class [BOOT-INF/classes/com/dfd/model/collections/ListElem.class] unexpectedly contains class [com.dfd.model.collections.ListElem]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter-web2.0.5.RELEASEspring-boot-starter-web-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter2.0.5.RELEASEspring-boot-starter-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter-logging2.0.5.RELEASEspring-boot-starter-logging-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar]
[proguard] Warning: class [META-INF/versions/9/org/apache/logging/log4j/util/ProcessIdUtil.class] unexpectedly contains class [org.apache.logging.log4j.util.ProcessIdUtil]
[proguard] Warning: class [META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class] unexpectedly contains class [org.apache.logging.log4j.util.StackLocator]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgapachelogginglog4jlog4j-to-slf4j2.10.0log4j-to-slf4j-2.10.0.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgapachelogginglog4jlog4j-api2.10.0log4j-api-2.10.0.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgslf4jjul-to-slf4j1.7.25jul-to-slf4j-1.7.25.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-core5.0.9.RELEASEspring-core-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-jcl5.0.9.RELEASEspring-jcl-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter-json2.0.5.RELEASEspring-boot-starter-json-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksoncorejackson-databind2.9.6jackson-databind-2.9.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksoncorejackson-core2.9.6jackson-core-2.9.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.6jackson-datatype-jdk8-2.9.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.6jackson-datatype-jsr310-2.9.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.6jackson-module-parameter-names-2.9.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter-tomcat2.0.5.RELEASEspring-boot-starter-tomcat-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgapachetomcatembedtomcat-embed-core8.5.34tomcat-embed-core-8.5.34.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgapachetomcatembedtomcat-embed-el8.5.34tomcat-embed-el-8.5.34.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgapachetomcatembedtomcat-embed-websocket8.5.34tomcat-embed-websocket-8.5.34.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorghibernatevalidatorhibernate-validator6.0.12.Finalhibernate-validator-6.0.12.Final.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomfasterxmlclassmate1.3.4classmate-1.3.4.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-web5.0.9.RELEASEspring-web-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-beans5.0.9.RELEASEspring-beans-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-webmvc5.0.9.RELEASEspring-webmvc-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-aop5.0.9.RELEASEspring-aop-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-context5.0.9.RELEASEspring-context-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkspring-expression5.0.9.RELEASEspring-expression-5.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-starter-thymeleaf2.0.5.RELEASEspring-boot-starter-thymeleaf-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgthymeleafthymeleaf-spring53.0.9.RELEASEthymeleaf-spring5-3.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgthymeleafthymeleaf3.0.9.RELEASEthymeleaf-3.0.9.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgattoparserattoparser2.0.4.RELEASEattoparser-2.0.4.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgunbescapeunbescape1.1.5.RELEASEunbescape-1.1.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgthymeleafextrasthymeleaf-extras-java8time3.0.1.RELEASEthymeleaf-extras-java8time-3.0.1.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-devtools2.0.5.RELEASEspring-boot-devtools-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot2.0.5.RELEASEspring-boot-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgspringframeworkbootspring-boot-autoconfigure2.0.5.RELEASEspring-boot-autoconfigure-2.0.5.RELEASE.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgjsoupjsoup1.11.3jsoup-1.11.3.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgooglegooglejavaformatgoogle-java-format1.6google-java-format-1.6.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgoogleguavaguava22.0guava-22.0.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgooglecodefindbugsjsr3051.3.9jsr305-1.3.9.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgoogleerrorproneerror_prone_annotations2.0.18error_prone_annotations-2.0.18.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgooglej2objcj2objc-annotations1.1j2objc-annotations-1.1.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositoryorgcodehausmojoanimal-sniffer-annotations1.14animal-sniffer-annotations-1.14.jar]
[proguard] Reading library jar [C:Usersadmin_test.m2repositorycomgoogleerrorpronejavac-shaded9+181-r4173-1javac-shaded-9+181-r4173-1.jar]
[proguard] Reading library jar [C:Program FilesJavajre1.8.0_201librt.jar]
[proguard] Reading library jar [C:Program FilesJavajdk1.8.0_191jrelibrt.jar]
[proguard] Warning: there were 31 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] Reading library jar [C:Program FilesJavajdk1.8.0_191jrelibjce.jar]
[proguard] Preparing output jar [D:Yandex.DiskYandexDiskprogrammingintellegi_ideadfd-editor-projectsdfd-editor-v0.4targetdfd-editor.jar]
为了混淆,我使用这个应用程序:github
这个程序完美地混淆了!
上发:
注意内部jar - 库:混淆器压缩它们,它们变得不正确。混淆后,有必要将可执行 jar - 文件内的所有 jar - 库替换为旧文件(来自旧的可执行 jar - 文件(。