我有模块化maven应用程序,“module1”依赖于“module2”,“module2”依赖于“module3”等。在module1中我有这样的东西:
<profile>
<id>obfuscate</id>
<build>
<plugins>
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<options>
<option>-allowaccessmodification</option>
<option>-keep public class com.test.Main { *; }</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>${proguard.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
这会成功模糊“module1”。我想创建具有所有混淆依赖项的单个jar(模糊的module1和module2等)。有可能吗?
答案 0 :(得分:4)
答案 1 :(得分:0)
尝试<assembly>
的{{1}}选项。引用您想要捆绑到混淆jar中的每个依赖项。请参阅examples。
答案 2 :(得分:0)
如果你想将包依赖罐放入你的超级罐,请使用shade插件!这是一个例子:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>