I am trying to obfuscate my classes through yguard and this is the pom that runs successfully except for the yguard part. I used the examples they gave but get no joy. Here is the pom ... I am not sure about the sequence of the plugins and the phases. not sure if it is done in the correct sequence, what else must i say to get the question posted ???

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>symbology</groupId>
        <artifactId>SymbologyStudio</artifactId>
        <version>1.0</version>
        <packaging>jar</packaging>
        <name>symbology-studioapp</name>
        
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
        <dependencies>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-api</artifactId>
                <version>0.10.5</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-impl</artifactId>
                <version>0.10.5</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-jackson</artifactId>
                <version>0.10.5</version>
            </dependency>
            <dependency>
                <groupId>com.ximpleware</groupId>
                <artifactId>vtd-xml</artifactId>
                <version>2.11</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.1.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.8.5</version>
            </dependency>
            <dependency>
                <groupId>com.yworks</groupId>
                <artifactId>yguard</artifactId>
                <version>3.1.0</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
        <build>
            <finalName>Symbology-Studio</finalName>
            <plugins>
                <plugin>                
                    <groupId>org.symbology</groupId>                
                    <artifactId>appidgenerator</artifactId>
                    <version>1.0-SNAPSHOT</version>                
                    <executions>                    
                        <execution>                        
                            <configuration>
                                <input>${project.basedir}/src/main/resources</input>
                                <archive>true</archive>
                                <src>Symbology-Studio-jar-with-dependencies.jar</src>
                                <directory>C:\symbology\STUDIO-APPS\</directory>
                                <prefix>SymStudio-</prefix>
                                <commit>true</commit>
                            </configuration>                        
                            <goals>                            
                                <goal>appKeyGenerator</goal>
                                <goal>appRegister</goal>
                            </goals>                    
                        </execution>
                    </executions>            
                </plugin>             
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>assembly</id>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <phase>package</phase>
                            <configuration>
                                <descriptorRefs>
                                    <descriptorRef>jar-with-dependencies</descriptorRef>
                                </descriptorRefs>
                                <archive>
                                    <manifest>
                                        <addClasspath>true</addClasspath>
                                        <mainClass>org.symbology.app.SymbologyStudio</mainClass>
                                    </manifest>
                                </archive>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!-- https://yworks.github.io/yGuard/setup/ -->
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <id>obfuscate</id>
                            <configuration>
                                <tasks>
                                    <property name="runtime_classpath" refid="maven.runtime.classpath"/>
                                    <taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${runtime_classpath}"/>
                                    <yguard>
                                        <inoutpair in="C:\Users\Temujinp\Documents\NetbeansProjects\SymbologyClient\target\Symbology-Studio.jar" out="C:\obfuscate\SymbologyClient.jar" />            
                                    </yguard>
                                </tasks>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
1

There are 1 best solutions below

0
Thomas Behr On

Your <yguard> task has no instructions on what yGuard is supposed to do. If you want yGuard to obfuscate your classes, at the very least you need to add the line

<rename logfile="${project.build.directory}/yguard.log.xml"/>

See the yGuard Documentation for further information.