|
|
@@ -151,20 +151,34 @@ public class War_Test {
|
|
|
*/
|
|
|
public static void test4() {
|
|
|
String projectRootDir = PathUtil.getProjectRootDir(AllTest.class);
|
|
|
- EncryptExecutor encryptExecutor = EncryptExecutor.builder()
|
|
|
- .originJarOrWar(projectRootDir + "my-project-with-encrypted-lib-have-pwd.war")
|
|
|
- .includePrefix("com.szlaozicl,com.aspire.ssm,org.springframework.aop.target.dynamic,com.fasterxml.jackson")
|
|
|
- .excludePrefix("com.aspire.ssm.config,com.aspire.ssm.util.Person")
|
|
|
- .finalName("jd")
|
|
|
- .password("pwd12345")
|
|
|
- .includeLibs("spring-aop-5.2.7.RELEASE.jar,jackson-core-2.10.4.jar")
|
|
|
- .tips("方法已经被class-winter加密保护了,请不要直接使用java -jar xxx.jar启动项目,请使用java -javaagent:xxx.jar -jar xxx.jar启动项目.")
|
|
|
- .alreadyProtectedLibs("encrypted-lib-have-pwd.jar:qwer123~")
|
|
|
- .build();
|
|
|
-
|
|
|
- String encryptedWar = encryptExecutor.process();
|
|
|
+ String originJarOrWar = projectRootDir + "my-project-with-encrypted-lib-have-pwd.war";
|
|
|
+ String includePrefix = "com.szlaozicl,com.aspire.ssm,org.springframework.aop.target.dynamic,com.fasterxml.jackson";
|
|
|
+ String excludePrefix = "com.aspire.ssm.config,com.aspire.ssm.util.Person";
|
|
|
+ String finalName = "jd";
|
|
|
+ String password = "pwd12345";
|
|
|
+ String includeLibs = "spring-aop-5.2.7.RELEASE.jar,jackson-core-2.10.4.jar";
|
|
|
+ String tips = "方法已经被class-winter加密保护了,请不要直接使用java -jar xxx.jar启动项目,请使用java -javaagent:xxx.jar -jar xxx.jar启动项目.";
|
|
|
+ String alreadyProtectedLibs = "encrypted-lib-have-pwd.jar:qwer123~";
|
|
|
+ String debug = "true";
|
|
|
+
|
|
|
+ String startBat = "java -jar " + projectRootDir + "class-winter-core-1.0.0.jar"
|
|
|
+ + " originJarOrWar=" + originJarOrWar
|
|
|
+ + " includePrefix=" + includePrefix
|
|
|
+ + " excludePrefix=" + excludePrefix
|
|
|
+ + " finalName=" + finalName
|
|
|
+ + " password=" + password
|
|
|
+ + " includeLibs=" + includeLibs
|
|
|
+ + " tips=" + (BashUtil.IS_WINDOWS ? "\"".concat(tips).concat("\"") : "'".concat(tips).concat("'"))
|
|
|
+ + " alreadyProtectedLibs=" + alreadyProtectedLibs
|
|
|
+ + " debug=" + debug
|
|
|
+ ;
|
|
|
+ // 加密
|
|
|
+ BashUtil.runBashAndPrint(startBat);
|
|
|
+
|
|
|
+
|
|
|
+ String encryptedJar = projectRootDir + finalName + ".war";
|
|
|
System.out.println();
|
|
|
- System.out.println("[加密以完成] 请使用web容器(如tomcat)启动war包:" + encryptedWar);
|
|
|
+ System.out.println("[加密以完成] 请使用web容器(如tomcat)启动war包:" + encryptedJar);
|
|
|
System.out.println("其中参数附加 -javaagent:class-winter-core.jar=password=pwd12345");
|
|
|
// System.out.println("其中参数附加 -javaagent:class-winter-core.jar=debug=true,password=pwd123");
|
|
|
System.out.println();
|