[proguard-maven-plugin] Don't strip MANIFEST.MF from jars listed in assembly

485 views
Skip to first unread message

hdohlmann

unread,
Nov 18, 2010, 7:51:19 AM11/18/10
to pyx4me-users
We use the proguard-maven-plugin to process a number of jars at the
same time.
This is done in a maven-pom-project that first copies all needed jars
using the maven-dependencies-plugin, obfuscates them using proguard-
maven-plugin, signs them using the maven-jarsigner-plugin, and finally
producing a zip-file of the lot with the maven-assembly-plugin.

The jars need to be obfuscated together, in order for proguard to know
about the internal-api methods and use the proper obfuscated names in
the different jars.

The problem is, that the jars specified in the <assembly>-section of
the proguard-maven-plugin has their META-INF/MANIFEST.MF file filtered
out.

What we would like is an option to disable this automatic filtering.
This could be a simple option (filterManifest, defaultFiltering,...),
or a section with default filter entries we could overwrite
(<assembly><filter></filter>...</assembly>).

Both of the above suggestions is meant to be backwards-compatible.

For the simple solution with the option, just wrapping the line
"filter.append("(!META-INF/MANIFEST.MF");" in an "if(filterManifest)"
would probably be sufficient.


Vlad Skarzhevskyy

unread,
Nov 18, 2010, 1:10:31 PM11/18/10
to pyx4me...@googlegroups.com
Added
   <assembly><filterManifest>false</filterManifest>

   Please see latest 2.1.0-SNAPSHOT

Need to have this in you your pom.
        <pluginRepositories>
...
<pluginRepository>
<id>pyx4j-web-snapshot</id>
<url>http://repository.pyx4j.com/maven2-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>


Vlad




--
You received this message because you are subscribed to the Google Groups "pyx4me-users" group.
To post to this group, send email to pyx4me...@googlegroups.com.
To unsubscribe from this group, send email to pyx4me-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyx4me-users?hl=en.


hdohlmann

unread,
Nov 22, 2010, 6:12:02 AM11/22/10
to pyx4me-users
The handling of the filter-string is rather unusable now:
Start-"(" is only added if filterManifest==true.
If filterManifest==true and addMavenDescriptor==false, the filter-
string starts with a ",".
No matter the value of filterManifest and addMavenDescriptor, a ")" is
always added.

I suggest collecting the 3 potential filter-entries: "!META-INF/
MANIFEST.MF", "!META-INF/maven/**", inc.filter in a list and building
up the filter string depending upon the number of entries in the list.
Something like this:
String getFilter(...) {
List<String> filters = getFilters(...);
if (filters.isEmpty) return "";
StringBuilder sb = new StringBuilder("(");
String sep = "";
String separator=",";
for (String filter : filters) {
sb.append(sep).append(filter);
sep = separator;
}
return sb.append(")").toString();
}

List<String> getFilters(...) {
List<String> result = new ArrayList<String>();
if(filterMainfest) result.add("!META-INF/MANIFEST.MF");
if(!addMavenDescriptor) result.add("!META-INF/maven/**");
if(inc.filter!=null) result.add(inc.filter);
return result;
}

/Henrik

Vlad Skarzhevskyy

unread,
Nov 22, 2010, 11:38:10 AM11/22/10
to pyx4me...@googlegroups.com
Ups my bad. Fixed.

Vlad


hdohlmann

unread,
Nov 29, 2010, 4:48:34 AM11/29/10
to pyx4me-users
Works splendidly! Thanks :-)
Only question is if the option should be moved up under configuration,
instead of being down in assembly. Right now we have
"addMavenDescriptor" under configuration.

/Henrik

Vlad Skarzhevskyy

unread,
Nov 29, 2010, 1:18:42 PM11/29/10
to pyx4me...@googlegroups.com
'addMavenDescriptor'  Also affects execution when  assembly is not used.
It asks progurad to remove META-INF/maven/*  from jar created by 'maven-jar-plugin'


Vlad


hdohlmann

unread,
Nov 29, 2010, 2:55:07 PM11/29/10
to pyx4me-users
Yes, I see your point :-)
Thanks for the swift addition.

Is there anything else in the pipeline, or will a release be on its
way?

On Nov 29, 7:18 pm, Vlad Skarzhevskyy <skarzhevs...@gmail.com> wrote:
> 'addMavenDescriptor'  Also affects execution when  assembly is not used.
> It asks progurad to remove META-INF/maven/*  from jar created by '*maven*-*
> jar*-*plugin'*
Reply all
Reply to author
Forward
0 new messages