0

I would have expected maven-shade-plugin to support:

<archive>
  <indexed>true</indexed
<archive>

but it does not seem to.

Is there another way to get the shaded jar indexed?

Mike Hanafey
  • 5,565
  • 4
  • 20
  • 26
  • For those who haven't heard of an _indexed jar_ before: [JAR files revealed, The META-INF directory, INDEX.LIST](http://www.ibm.com/developerworks/library/j-jar/index.html): _"This file is generated by the new -i option of the jar tool and contains location information for packages defined in an application or extension. It is part of the JarIndex implementation and used by class loaders to speed up the class loading process."_ – Gerold Broser Oct 15 '14 at 19:50

1 Answers1

0

It is as it seems. DefaultShader.java contains:

if ( "META-INF/INDEX.LIST".equals( name ) )
{
    // we cannot allow the jar indexes to be copied over or the
    // jar is useless. Ideally, we could create a new one
    // later
    continue;
}

Apparently this ideal situation never stepped on since I couldn't find "INDEX.LIST" anywhere else in source-release.zip.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • Maybe I am missing your point, but INDEX.LIST from the input jars can never be usefully copied to the output jar because the index would be invalid in the output jar. So the referenced code fragment means you do not have to put in an explicit element to exclude these. Another useful default might be to exclude signature files like *.RSA because jar signing cannot carry over either. – Mike Hanafey Oct 15 '14 at 21:34
  • @MikeHanafey My point was that it _seemed_ to you that (re-)indexing is not supported. My findings are a confirmation for this assumption. I think the code fragment means that the implementer(s) thought of re-indexing the newly created jar but didn't implement it (yet) since [MSHADE-13](http://jira.codehaus.org/browse/MSHADE-13?jql=project%20%3D%20mshade%20AND%20text%20~%20%22index.list%22). – Gerold Broser Oct 15 '14 at 21:57