Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for WAR file processing #57

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 91 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,94 @@
ProGuard Maven Plugin
---------------------
ProGuard Maven Plugin (with WAR support)
----------------------------------------

This project is a fork of [wvengen's proguard maven plugin](https://github.com/wvengen/proguard-maven-plugin)
with focus on easier _war_ file processing with [ProGuard].

If plugin's input jar is a war file, the plugin uses the following workflow:

1. The war file is extracted to a temporary directory
(in build directory, with _'_war_proguard_expanded'_ appended to base war file name)
1. Artifacts referenced by assembly inclusions section (with wildcard supported for artifactId)
are used as ProGuard _injars_. All other artifacts are used as _libraryjars_.
Input artifacts files that exist in _WEB-INF/lib_, are referenced using that location
rather than location within user's maven repository.
1. Proguarded classes and resources will be out to a jar file in _WEB-INF/lib_ named by the artifact.
Processed input jars located in _WEB-INF/lib_ are deleted.
1. If _processWarClassesDir_ option is enabled, _WEB-INF/classes_ will be processed as _injars_
and output separately (to replace existing _WEB-INF/classes_ directory).
1. Finally, output war archive is created.

Additional configuration parameters supported:

- processWarClassesDir - if enabled, WEB-INF/classes will be processed as _injars_
- attachMap - whether or not to attach proguard map file as an artifact
- attachMapArtifactType - defaults to _txt_
- attachMapArtifactClassifier - defaults to _proguard-map_
- attachSeed - whether or not to attach proguard seed file as an artifact
- attachSeedArtifactType - defaults to _txt_
- attachSeedArtifactClassifier - defaults to _proguard-seed_


### Configuration example for war

<plugin>
<groupId>com.github.radomirml</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.9</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<configuration>
<proguardVersion>4.8</proguardVersion>
<obfuscate>true</obfuscate>
<maxMemory>1024m</maxMemory>
<includeDependency>true</includeDependency>
<processWarClassesDir>true</processWarClassesDir>
<options>
<option>-ignorewarnings</option>
<option>-repackageclasses xyz</option>
<option>-dontoptimize</option>
</options>
<assembly>
<inclusions>
<inclusion>
<groupId>${project.groupId}</groupId><artifactId>*</artifactId>
</inclusion>
</inclusions>
</assembly>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId><artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId><artifactId>*</artifactId>
</exclusion>
</exclusions>
<injar>${project.build.finalName}.war</injar>
<!--<outjar>${project.build.finalName}-proguarded.war</outjar> - not required (proguarded added by default) -->
<outputDirectory>${project.build.directory}</outputDirectory>
<attach>true</attach>
<appendClassifier>true</appendClassifier>
<attachArtifactClassifier>proguarded</attachArtifactClassifier>
<attachArtifactType>war</attachArtifactType>
<attachMap>true</attachMap>
<attachSeed>true</attachSeed>
<proguardInclude>${basedir}/proguard.conf</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<addMavenDescriptor>false</addMavenDescriptor>
<skip>false</skip>
</configuration>
</plugin>


## Base project description

Run [ProGuard] as part of your [Maven] build. For usage, please read the
generated [Documentation](http://wvengen.github.io/proguard-maven-plugin/).
Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<issueManagement>
<system>GitHub</system>
<url>https://github.com/wvengen/proguard-maven-plugin/issues</url>
<url>https://github.com/radomirml/proguard-maven-plugin/issues</url>
</issueManagement>

<developers>
Expand All @@ -49,6 +49,11 @@
<name>cmorty</name>
<email>[email protected]</email>
</developer>
<developer>
<id>radomirml</id>
<name>radomirml</name>
<email>[email protected]</email>
</developer>
</developers>


Expand Down Expand Up @@ -87,6 +92,12 @@
<version>3.1.1</version>
</dependency>

<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.5.15</version>
</dependency>

</dependencies>

<build>
Expand Down
Loading