Comments (5)
______________ _____________________________
__ ____/__ /_______ __ /__ ____/__ __ \__ __/
_ / __ __ \ __ `/ __/ / __ __ /_/ /_ /
/ /___ _ / / / /_/ // /_ / /_/ / _ ____/_ /
\____/ /_/ /_/\__,_/ \__/ \____/ /_/ /_/
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:
-
Add the plugin in the
plugins
section of thepom.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>
-
Specify the
injar
configuration to point to the input JAR file that should be processed by Proguard. In this example, theinjar
value is set to${project.build.finalName}.jar
. -
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. -
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.
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.
______________ _____________________________
__ ____/__ /_______ __ /__ ____/__ __ \__ __/
_ / __ __ \ __ `/ __/ / __ __ /_/ /_ /
/ /___ _ / / / /_/ // /_ / /_/ / _ ____/_ /
\____/ /_/ /_/\__,_/ \__/ \____/ /_/ /_/
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:
- In the parent/root module's
pom.xml
, add theplugins
section inside thebuild/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>
- 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.
Can we even omit the executions
part in sub-modules as it is defined in parent module already?
from chatgpt-java.
______________ _____________________________
__ ____/__ /_______ __ /__ ____/__ __ \__ __/
_ / __ __ \ __ `/ __/ / __ __ /_/ /_ /
/ /___ _ / / / /_/ // /_ / /_/ / _ ____/_ /
\____/ /_/ /_/\__,_/ \__/ \____/ /_/ /_/
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)
- helloQ: HOT 1
- Q: 你好 HOT 1
- Q: What is your name? HOT 1
- Q: What is your name? HOT 1
- Q:你是太完美 HOT 1
- 这个项目可以配置转发ip和端口吗 HOT 5
- 你是谁 HOT 1
- how many days have a week ?
- Q: What chatgpt does stand for HOT 1
- Q: hi HOT 1
- Q: 介绍你自己
- Q: download lib openAi for java HOT 1
- Q: let's write something HOT 1
- Q: hello HOT 1
- Q: bằng kiến thức vật lý quang học, hãy đưa ra một list các hints để người xem có thể đưa ra chính xác cụm từ: "lăng kính". HOT 1
- Q: Testing HOT 1
- nonono HOT 1
- Q:hello HOT 1
- Q: Tell me why I should use this sdk instead of another?' HOT 1
- Q: I have 10 apples today and I ate 4 apples last week, then how many apples left today? Think very carefully. HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatgpt-java.