Giter Club home page Giter Club logo

Comments (5)

github-actions avatar github-actions commented on May 29, 2024
______________        _____________________________
__  ____/__  /_______ __  /__  ____/__  __ \__  __/
_  /    __  __ \  __ `/  __/  / __ __  /_/ /_  /
/ /___  _  / / / /_/ // /_ / /_/ / _  ____/_  /
\____/  /_/ /_/\__,_/ \__/ \____/  /_/     /_/

2023-03-10T10:28:45.973Z WARN 1668 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
You are now at conversation: issue-26
System message set to: ""
To use Proguard Maven plugin in a multi-module project, you will need to add it to the respective module's pom.xml file. Here are the steps to follow:

  1. Add the plugin in the plugins section of the pom.xml file of the desired module. Here is an example configuration:

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.14</version>
                <executions>
                    <execution>
                        <id>proguard</id>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                        <configuration>
                            <injar>${project.build.finalName}.jar</injar>
                            <obfuscate>true</obfuscate>
                            <attach>true</attach>
                            <options>
                                <option>-dontoptimize</option>
                                <option>-keep public class com.example.module.** { *; }</option>
                                <!-- more options can be specified here -->
                            </options>
                            <libs>
                                <lib>${java.home}/lib/rt.jar</lib>
                            </libs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
  2. Specify the injar configuration to point to the input JAR file that should be processed by Proguard. In this example, the injar value is set to ${project.build.finalName}.jar.

  3. Specify the desired Proguard options in the options section. Here, we have set three options, including -dontoptimize that disables optimization, -keep public class com.example.module.** { *; } that keeps all public classes in the com.example.module package and sub-packages, and more can be added.

  4. Run the mvn package command to package the module with Proguard obfuscation.

Note: If you want to apply Proguard to multiple modules, you will need to add the plugin configuration to each of the module's pom.xml files.

from chatgpt-java.

kezhenxu94 avatar kezhenxu94 commented on May 29, 2024

Please rewrite the configuration, move the plugin configuration into pluginManagement in the root module, and so we can only add the plugin definition without duplicating the configurations in every sub module.

from chatgpt-java.

github-actions avatar github-actions commented on May 29, 2024
______________        _____________________________
__  ____/__  /_______ __  /__  ____/__  __ \__  __/
_  /    __  __ \  __ `/  __/  / __ __  /_/ /_  /
/ /___  _  / / / /_/ // /_ / /_/ / _  ____/_  /
\____/  /_/ /_/\__,_/ \__/ \____/  /_/     /_/

2023-03-10T10:31:11.489Z WARN 1688 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
You are now at conversation: issue-26
Sure, here's how you can move the Proguard plugin configuration to pluginManagement in the parent/root module and avoid duplicating the configuration across all submodules:

  1. In the parent/root module's pom.xml, add the plugins section inside the build/pluginManagement element, like this:
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.0.14</version>
                <executions>
                    <execution>
                        <id>proguard</id>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                        <configuration>
                            <injar>${project.build.finalName}.jar</injar>
                            <obfuscate>true</obfuscate>
                            <attach>true</attach>
                            <options>
                                <option>-dontoptimize</option>
                                <option>-keep public class com.example.module.** { *; }</option>
                                <!-- more options can be specified here -->
                            </options>
                            <libs>
                                <lib>${java.home}/lib/rt.jar</lib>
                            </libs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
  1. In the submodules that you want to apply Proguard to, add the following code to their build/plugins section:
<build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>proguard</id>
                    <phase>package</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Note that in the submodules, you only need to add the plugin definition with minimal configuration. That's because the configuration is already defined in the parent/root module's pluginManagement section.

With these changes, the Proguard plugin is now configured in the parent module and can be used in any submodule without duplicating the configuration.

from chatgpt-java.

kezhenxu94 avatar kezhenxu94 commented on May 29, 2024

Can we even omit the executions part in sub-modules as it is defined in parent module already?

from chatgpt-java.

github-actions avatar github-actions commented on May 29, 2024
______________        _____________________________
__  ____/__  /_______ __  /__  ____/__  __ \__  __/
_  /    __  __ \  __ `/  __/  / __ __  /_/ /_  /
/ /___  _  / / / /_/ // /_ / /_/ / _  ____/_  /
\____/  /_/ /_/\__,_/ \__/ \____/  /_/     /_/

2023-03-10T10:34:06.180Z WARN 1683 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
You are now at conversation: issue-26
Yes, you can omit the executions part in the sub-modules since it's already defined in the parent module's pluginManagement section. Your sub-module's pom.xml file should only contain the following plugin configuration:

<build>
    <plugins>
        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

This way, you don't need to repeat the execution configuration in every sub-module's pom.xml. The pluginManagement section in the parent module sets up the plugin configuration, including its executions, which can be inherited by the sub-modules.

from chatgpt-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.