Configure Obfuscation with the PreEmptive Protection DashO in Apache Maven Project
Download DashO for Android & Java on PreEmptive Solutions and then extract it into a local directory. For example: C:\programming\DashO-9.3.0.
Activate the DashO with DashOGUI.
Download Open Java Development Kit (OpenJDK) and then extract it into a local directory. For example: C:\Java\jdk-11.0.2.
Dwonload Apache Maven and then extract it into a local directory. For example: C:\programming\apache-maven-3.6.1.
Configure the user variable DASHO_HOME , DASHO_JAVA_HOME , JAVA_HOME , MAVEN_HOME .
DASHO_HOME=C:\p rogramming\D ashO-9.3.0
DASHO_JAVA_HOME=C:\J ava\j dk-11.0.2
JAVA_HOME=C:\J ava\j dk-11.0.2
MAVEN_HOME=C:\p rogramming\a pache-maven-3.6.1
Configure the system variable PATH , add the following links.
C:\J ava\j dk-11.0.2\b in
C:\p rogramming\a pache-maven-3.6.1\b in
Build Maven Project with DashO
Method 1 (Use of Apache Maven AntRun Plugin)
Open pom.xml, add the following code to plugins tag.
<plugin >
<artifactId >maven-antrun-plugin</artifactId >
<version >1.8</version >
<executions >
<execution >
<id >obfuscate</id >
<phase >package</phase >
<configuration >
<target >
<dependencyfilesets />
<property name =" PARAM_KEY" >PARAM_VALUE</property >
<typedef resource =" preemptive/dasho/anttask/antlib.xml" classpathref =" maven.plugin.classpath" />
<ant antfile =" ant.build.xml" >
<target name =" dasho" />
</ant >
</target >
</configuration >
<goals >
<goal >run</goal >
</goals >
</execution >
</executions >
<dependencies >
<dependency >
<groupId >preemptive.dasho</groupId >
<artifactId >ant-dasho</artifactId >
<version >9.3.0</version >
</dependency >
<dependency >
<groupId >preemptive.dasho</groupId >
<artifactId >doxfile</artifactId >
<version >9.3.0</version >
</dependency >
<dependency >
<groupId >preemptive.dasho</groupId >
<artifactId >xsdlib</artifactId >
<version >9.3.0</version >
</dependency >
<dependency >
<groupId >preemptive.dasho</groupId >
<artifactId >relaxngDatatype</artifactId >
<version >9.3.0</version >
</dependency >
<dependency >
<groupId >javax.xml.bind</groupId >
<artifactId >jaxb-api</artifactId >
<version >2.3.1</version >
</dependency >
<dependency >
<groupId >com.sun.xml.bind</groupId >
<artifactId >jaxb-impl</artifactId >
<version >2.3.2</version >
</dependency >
<dependency >
<groupId >com.sun.xml.bind</groupId >
<artifactId >jaxb-libs</artifactId >
<version >1.0.6</version >
</dependency >
<dependency >
<groupId >javax.servlet</groupId >
<artifactId >servlet-api</artifactId >
<version >2.5</version >
</dependency >
<dependency >
<groupId >org.apache.ant</groupId >
<artifactId >ant</artifactId >
<version >1.10.6</version >
</dependency >
</dependencies >
</plugin >
Use the property tag to pass the KEY and VALUE pair to ant buildfile.
Change the ant buildfile path in the ant tag.
Set the ant target in the target tag.
Add the following target in the ant buildfile.
<target name =" dasho" >
<java fork =" true" classname =" DashOPro" classpath =" ${env.DASHO_HOME}/DashOPro.jar" failonerror =" true" >
<jvmarg value =" -Djava.awt.headless=true" />
<arg value =" -v" />
<arg file =" dasho.obfuscate.dox" />
<sysproperty key =" PARAM_KEY" value =" PARAM_VALUE" />
</java >
</target >
Change the value of arg tag with the property file to the DashO project file path.
Use the sysproperty tag to pass the KEY and VALUE pair to DashO project.
Method 2 (Use of MojoHaus Exec Maven Plugin)
Open pom.xml, add the following code to plugins tag.
<plugin >
<groupId >org.codehaus.mojo</groupId >
<artifactId >exec-maven-plugin</artifactId >
<version >1.6.0</version >
<executions >
<execution >
<id >DashO</id >
<phase >package</phase >
<goals >
<goal >exec</goal >
</goals >
</execution >
</executions >
<configuration >
<executable >java</executable >
<arguments >
<argument >-Xms512m</argument >
<argument >-Xss1m</argument >
<!-- <argument>-verbose:gc</argument> -->
<argument >-Djava.awt.headless=true</argument >
<argument >-DPARAM_KEY=PARAM_VALUE</argument >
<argument >-jar</argument >
<argument >${env.DASHO_HOME}/DashOPro.jar</argument >
<argument >--quiet</argument >
<argument >dasho.obfuscate.dox</argument >
</arguments >
</configuration >
</plugin >
Use the argument tag with -D as the value prefix to pass the KEY and VALUE pair to DashO project.
Update the last argument element to the DashO project file path.