How to provide the index for jar files generated by gradle? (besides direct calls to ant.jar (index: true) )


(Davide Cavestro) #1

Is there a way to directly provide the index for jar files generated by gradle (besides calling ant.jar (index: true) )? See http://download.oracle.com/javase/1.4.2/docs/guide/jar/jar.html#Index%20File%20Specification and http://download.oracle.com/javase/1.5.0/docs/guide/jar/jar.html#JAR%20Index


(Szczepan Faber) #2

Jar task does not have that capability at the moment (as of 1.0-milestone-7). Depending on priorities and demand we can schedule the implementation at some point. Fancy contributing? :slight_smile:


(d.cavestro) #3

This quick and dirty workaround could serve as a basis for more comprehensive support:

jar << {
 configurations.archives.artifacts.each {
  def path = it.archiveTask.archivePath
  logger.lifecycle "indexing ${path}"
  ant.jar (update: true, index: true, destfile: path)
 }
}

Davide Cavestro PS: I write with a different account cause the login with google account no longer works for me (I only get a blank page) UPDATE: consider we could also index contents from other jars ( http://ant.apache.org/manual/Tasks/jar.html#indexjars ) provided that this makes sense for our use caseā€¦ it could be useful for jnlp/applets in order to achieve lazy downloading


(Lari Hotari) #4

JarIndex might make the performance worse: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7100860