Help with combining stuff in META-INF/ for use in an uber .jar#18
Merged
Conversation
It is much more robust to use ClassLoader's getResources() method than trying to iterate the class path elements extracted from the java.class.path property, especially when running via exec-maven-plugin (which does not have the relevant .jar files in the system class path). While at it, look for both modern and legacy annotations, but return only file names prefixed with the modern prefix in getAnnotationFiles(). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Instead of reading all the JSON-formatted indexes ourselves, we can simply ask the Index class to get all of them for us, including the legacy annotation indexes, and then write them out using the existing infrastructure. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This trick was performed by: mvn license:update-file-header Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Created a new interface: Combiner - and extracted the service combining logic from MetaInfCombiner to a new ServiceCombiner (which implements Combiner). The purpose of MetaInfCombiner is now purely to run both the ServiceCombiner and CombineAnnotations classes.
The org.scijava.annotations CombineAnnotations class now implements the Combiner interface. It was refactored to remove state, allowing its combine method to now take any output directory (instead of requiring constructing a new instance for each output dir). The class was renamed to AnnotationCombiner to fit the naming scheme of MetaInfCombiner and ServiceCombiner. The org.scijava.util.CombineAnnotations class was updated to use the refactored AnnotationCombiner API.
hinerm
added a commit
that referenced
this pull request
Dec 20, 2013
When making one single uber .jar from a multitude of dependencies, we need not only take care of annotation indexes (including legacy ones), but also of the entries in META-INF/services/.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When making one single uber .jar from a multitude of dependencies, we need not only take care of annotation indexes (including legacy ones), but also of the entries in
META-INF/services/.