Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
/ Jarex Public archive

An extensible Java library to explore JAR files.

License

Notifications You must be signed in to change notification settings

Emerjoin/Jarex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adding Jarex to your project

You must add a repository and a dependency to your pom.xml

Repository

   <repositories>
        <repository>
            <id>Emerjoin</id>
            <name>maven-repo</name>
            <url>https://github.com/Emerjoin/maven-repo/raw/master</url>
        </repository>
    </repositories>

Dependency

    <dependency>
         <groupId>org.emerjoin</groupId>
         <artifactId>Jarex</artifactId>
         <version>1.0.0</version>
    </dependency>

Usage Examples

Looking for beans.xml in all jars

    
    Query beansXML = Queries.fileEntry("META-INF/beans.xml");
    
    ClassLoader classLoader = //get classloader here
    Jarex.createInstance(classLoader)
         .all(beansXML) //Find all
         .withResults().of(beansXML).forEach(item -> {
            
            InputStream stream = item.getInputStream();
            //do whatever you want here
            
         });
    

Looking for persistence.xml

    
    Query persistenceXML = Queries.fileEntry("META-INF/persistence.xml");
    
    ClassLoader classLoader = //get classloader here
    Optional<ResultsWrapper.Item> persistenceDescriptor = Jarex.createInstance(classLoader)
         .one(persistenceXML)
         .withResults().of(persistenceXML).findFirst();
    

Finding both beans.xml and persistence.xml using a single Jarex Instance

    Query persistenceXML = Queries.fileEntry("META-INF/persistence.xml");
    Query beansXML = Queries.fileEntry("META-INF/beans.xml");
    
    ClassLoader classLoader = //get classloader here
    Jarex jarex = Jarex.createInstance(classLoader)
        .one(persistenceXML)
        .all(beansXML);
   
    Optional<ResultsWrapper.Item> persistenceDescriptor = jarex.withResults()
        .of(persistenceXML).findFirst();
     
    jarex.withResults().of(beansXML).forEach(item -> {
                         
         InputStream stream = item.getInputStream();
         //do whatever you want here
                         
    });
        

About

An extensible Java library to explore JAR files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages