简体   繁体   English

如何替换 Axis2 生成的 AAR 文件中的文件?

[英]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.我正在调整一个最终出现在我的 aar axis2 Web 服务文件中的文件。 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?我不想每次进行更改时都必须构建整个 aar,是否有一种简单的方法可以替换 aar 文件中的项目?

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. Axis2 AAR文件只是一个JAR(与WAR文件是JAR的方式相同),而JAR基本上是一个ZIP文件。 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. 这取决于您想要的内容(GUI或命令行)以及所使用的操作系统。

For your Axis2 to work, you don't need an aar file.要使 Axis2 正常工作,您不需要aar文件。

services.xml file can be either of the below locations for the Axis2 to work. services.xml文件可以是 Axis2 工作的以下任一位置。

repository/services/SimpleService/meta-inf/services.xml WEB-INF/services/SimpleService/meta-inf/services.xml存储库/服务/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.这将帮助我们有一个额外的步骤来生成 aar 文件。

ServiceDeployer.java服务部署者.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 https://axis.apache.org/axis2/java/core/apidocs/org/apache/axis2/deployment/ServiceDeployer.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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