Skip to content

Commit de40385

Browse files
committed
Add support for the proguard to minimize jar file.
1 parent 0581d52 commit de40385

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

lodash-plugin/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,28 @@
6868
</archive>
6969
</configuration>
7070
</plugin>
71+
<plugin>
72+
<groupId>com.github.wvengen</groupId>
73+
<artifactId>proguard-maven-plugin</artifactId>
74+
<version>2.0.10</version>
75+
<executions>
76+
<execution>
77+
<phase>package</phase>
78+
<goals><goal>proguard</goal></goals>
79+
</execution>
80+
</executions>
81+
<configuration>
82+
<options>
83+
<option>-allowaccessmodification</option>
84+
<option>-renamesourcefileattribute SourceFile</option>
85+
<option>-keepattributes Signature,InnerClasses,SourceFile,LineNumberTable</option>
86+
<option>-keep public class com.github.underscore.lodash.$ { *; }</option>
87+
</options>
88+
<libs>
89+
<lib>${java.home}/lib/rt.jar</lib>
90+
</libs>
91+
</configuration>
92+
</plugin>
7193
<plugin>
7294
<groupId>org.apache.maven.plugins</groupId>
7395
<artifactId>maven-shade-plugin</artifactId>

pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,42 @@
120120
</execution>
121121
</executions>
122122
</plugin>
123+
<plugin>
124+
<groupId>com.github.wvengen</groupId>
125+
<artifactId>proguard-maven-plugin</artifactId>
126+
<version>2.0.10</version>
127+
<executions>
128+
<execution>
129+
<phase>package</phase>
130+
<goals><goal>proguard</goal></goals>
131+
</execution>
132+
</executions>
133+
<configuration>
134+
<options>
135+
<option>-allowaccessmodification</option>
136+
<option>-renamesourcefileattribute SourceFile</option>
137+
<option>-keepattributes Signature,InnerClasses,SourceFile,LineNumberTable</option>
138+
<option>-keep public class com.github.underscore.$ { *; }</option>
139+
<option>-keep public class com.github.underscore.*$Chain { *; }</option>
140+
<option>-keep public class com.github.underscore.Block { *; }</option>
141+
<option>-keep public class com.github.underscore.Function { *; }</option>
142+
<option>-keep public class com.github.underscore.Function1 { *; }</option>
143+
<option>-keep public class com.github.underscore.Function2 { *; }</option>
144+
<option>-keep public class com.github.underscore.Function3 { *; }</option>
145+
<option>-keep public class com.github.underscore.Function4 { *; }</option>
146+
<option>-keep public class com.github.underscore.FunctionAccum { *; }</option>
147+
<option>-keep public class com.github.underscore.MemoizeFunction1 { *; }</option>
148+
<option>-keep public class com.github.underscore.Optional { *; }</option>
149+
<option>-keep public class com.github.underscore.Predicate { *; }</option>
150+
<option>-keep public class com.github.underscore.Template { *; }</option>
151+
<option>-keep public class com.github.underscore.Tuple { *; }</option>
152+
<option>-keepclassmembers class * { *** newArrayList(); *** newLinkedHashSet(); *** newHashSet(java.lang.Iterable); *** newLinkedHashMap(); }</option>
153+
</options>
154+
<libs>
155+
<lib>${java.home}/lib/rt.jar</lib>
156+
</libs>
157+
</configuration>
158+
</plugin>
123159
<plugin>
124160
<groupId>org.apache.maven.plugins</groupId>
125161
<artifactId>maven-site-plugin</artifactId>

0 commit comments

Comments
 (0)