简体   繁体   中英

How to replace file inside an Axis2 generated AAR file?

I'm tweaking a file that eventually ends up inside my aar axis2 web services file. I don't want to have to build the whole aar each time I make a change, is there an easy way to replace items within the aar file?

An Axis2 AAR file is just a JAR (in the same way as a WAR file is a JAR), and a JAR is basically a ZIP file. Therefore there are plenty of tools to do that. It depends on what you want (GUI or command line) and on the OS you are using.

For your Axis2 to work, you don't need an aar file.

services.xml file can be either of the below locations for the Axis2 to work.

repository/services/SimpleService/meta-inf/services.xml WEB-INF/services/SimpleService/meta-inf/services.xml

This will help us have an extra step of generating the aar file.

ServiceDeployer.java

 * <p>
 * Standard Axis2 service Deployer which use services.xml file to build
 * services. ServiceDeployer can be used with Axis2 archive (.aar) or exploded
 * directory structure. Some of the example formats given below.
 * </p>
 * <p>Examples : <p>
 *        <ul>
 *          <li>repository/services/SimpleService.aar/meta-inf/services.xml</li>
 *          <li>repository/services/SimpleService/meta-inf/services.xml</li>
 *          <li>WEB-INF/services/SimpleService.aar/meta-inf/services.xml</li>
 *          <li>WEB-INF/services/SimpleService/meta-inf/services.xml</li>
 *       </ul>
 
     InputStream servicexmlStream = serviceClassLoader
            .getResourceAsStream("META-INF/services.xml");
    if (servicexmlStream == null) {
        servicexmlStream = serviceClassLoader.getResourceAsStream("meta-inf/services.xml");
    } else {
        metainf = "META-INF";
    }

https://axis.apache.org/axis2/java/core/apidocs/org/apache/axis2/deployment/ServiceDeployer.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM