proguard-maven-plugin icon indicating copy to clipboard operation
proguard-maven-plugin copied to clipboard

Hot links in documentation don't work

Open peterkronenberg opened this issue 4 years ago • 5 comments

Hi, I'm trying to get this plugin working, but having some difficulty. The hotlinks at https://wvengen.github.io/proguard-maven-plugin don't seem to work. And I can't find documentation on the various configuration elements and options

I posted an issue here, https://stackoverflow.com/questions/69667717/obfuscate-java-jar-with-proguard-plug-in, but haven't gotten a response yet.

peterkronenberg avatar Oct 22 '21 19:10 peterkronenberg

Hi. The docs do contain some outdated links. The Proguard documentation itself is located in https://www.guardsquare.com/manual/home

The Maven plugin parameter documentation is located in https://wvengen.github.io/proguard-maven-plugin/proguard-mojo.html but most of the parameters are not needed for basic obfuscation. [proguard] Warning: class [BOOT-INF/classes/com/torchai/service/textextractor/aspect/ControllerLayerAspect.class] unexpectedly contains class [com.torchai.service.textextractor.aspect.ControllerLayerAspect] is a false positive and only a warning. See https://github.com/Guardsquare/proguard-core/blob/d171cfa11c79e77914cc113dbfb235ff95d92a82/src/main/java/proguard/io/ClassReader.java#L107 You could report this to https://github.com/Guardsquare/proguard-core/issues The code should probay strip away the "BOOT-INF/classes/" in the name comparison.

Note: duplicate definition of library class happens because you have the same dependency twice in your Maven dependencies, probably with two different versions. This is something you will want to take a look at. Check also https://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html to make preventing this easier. For you the javax.annotation.ManagedBean probably comes once from the Java EE server libraries and once through some other dependency. See how many other dependencies depend on the Javax Annotation API: https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api/usages

lasselindqvist avatar Oct 22 '21 20:10 lasselindqvist

Thanks. I didn't think I should have to specify many options, but I couldn't get it working

This is the config I'm using

<plugin>                                                              
    <groupId>com.github.wvengen</groupId>                             
    <artifactId>proguard-maven-plugin</artifactId>                    
    <version>2.5.1</version>                                          
    <dependencies>                                                    
        <dependency>                                                  
            <groupId>com.guardsquare</groupId>                        
            <artifactId>proguard-base</artifactId>                    
            <version>7.1.1</version>                                  
            <scope>runtime</scope>                                    
        </dependency>                                                 
        <dependency>                                                  
            <groupId>com.guardsquare</groupId>                        
            <artifactId>proguard-core</artifactId>                    
            <version>7.1.1</version>                                  
            <scope>runtime</scope>                                    
        </dependency>                                                 
    </dependencies>                                                   
    <executions>                                                      
        <execution>                                                   
            <phase>package</phase>                                    
            <goals>                                                   
                <goal>proguard</goal>                                 
            </goals>                                                  
        </execution>                                                  
    </executions>                                                     
    <configuration>                                                   
        <obfuscate>true</obfuscate>                                   
        <injar>${project.build.finalName}.jar</injar>                 
        <outjar>${project.build.finalName}-small.jar</outjar>         
        <outputDirectory>${project.build.directory}</outputDirectory> 
        <proguardVersion>7.1.1</proguardVersion>                      
        <options>                                                     
                                                                      
        </options>                                                    
        <libs>                                                        
            <lib>${java.home}/lib/rt.jar</lib>                        
            <lib>${java.home}/lib/jce.jar</lib>                       
        </libs>                                                       
    </configuration>                                                  
</plugin>                    

peterkronenberg avatar Oct 22 '21 21:10 peterkronenberg

Wow, I just ran the plugin at https://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html and I wouldn't even know where to begin. But is this a fatal error? Is this what's casing Proguard to fail?

Even though they are Warnings, I get an error that says Error: Please correct the above warnings

peterkronenberg avatar Oct 22 '21 21:10 peterkronenberg

I got a little further by specifying -ignorewarnings, which I'm still not sure is a good thing to do, but now I'm getting lots of messages like this: image

image

It tells me to use the -keep option on elements with -printseeds, which I don't understand at all. And then it also seens there were 3 access to class members by means of reflection, but I'm not sure how to tell what they are.

peterkronenberg avatar Oct 22 '21 21:10 peterkronenberg

The dependencyConverge problems are not usually errors, but it tells you that the dependency version you get to the final product might be somewhat random, so those are things you want to check out.

The "-keep/-printseeds" error is the one failing your build. So you need to check your options. The ones you showed were empty, but I assume in reality you have some options there. Also the problems there do relate really to Proguard, not this plugin.

lasselindqvist avatar Oct 23 '21 04:10 lasselindqvist