Maven2 AAR Eclipse插件没有将services.xml添加到aar

时间:2012-06-30 23:50:43

标签: maven-2 eclipse-plugin axis2

Maven大师,请在这里帮助新手:

我的POM看起来像这样:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.pidac.webservices</groupId>
  <artifactId>axis2test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>Axis2-test</name>

   <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-aar-maven-plugin</artifactId>
                <version>1.6.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>axis2-aar:aar</goal>
                        </goals>
                        <configuration>                             
                            <fileSets>
                                <fileSet>
                                     <directory>${project.build.directory}/aar</directory>
                                     <outputDirectory>/</outputDirectory>
                                </fileSet>
                                <fileSet>
                                    <directory>$(basedir)/src/main/webapp/META-INF</directory>
                                    <outputDirectory>META-INF</outputDirectory>
                                </fileSet>                                  
                            </fileSets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </pluginManagement>
   </build>   
</project>

我的文件夹结构如下所示:

enter image description here

我的调试配置包含以下目标列表:

  

清理安装axis2-aar:aar

从Eclipse开始,当我从Debug As上下文菜单运行Maven Build时,右键单击项目时会出现,我将aar放到我的目标文件夹中,如下面的输出所示:

DEBUG] Exploding aar...
[DEBUG] Assembling aar axis2test in C:\Users\nji\workspace\axis2test\target\aar
[INFO] Generating aar C:\Users\nji\workspace\axis2test\target\axis2test-0.0.1-SNAPSHOT.aar
[INFO] Building jar: C:\Users\nji\workspace\axis2test\target\axis2test-0.0.1-SNAPSHOT.aar
[DEBUG] adding directory META-INF/
[DEBUG] adding entry META-INF/MANIFEST.MF
[DEBUG] adding directory com/
[DEBUG] adding directory com/pidac/
[DEBUG] adding directory com/pidac/axis2test/
[DEBUG] adding directory com/pidac/axis2test/api/
[DEBUG] adding directory com/pidac/axis2test/lib/
[DEBUG] adding entry com/pidac/axis2test/api/Hello.class
[DEBUG] adding entry com/pidac/axis2test/api/Weather.class
[DEBUG] adding entry com/pidac/axis2test/lib/HelloImpl.class
[DEBUG] adding entry com/pidac/axis2test/lib/WeatherService.class
[DEBUG] adding directory META-INF/maven/
[DEBUG] adding directory META-INF/maven/org.pidac.webservices/
[DEBUG] adding directory META-INF/maven/org.pidac.webservices/axis2test/
[DEBUG] adding entry META-INF/maven/org.pidac.webservices/axis2test/pom.xml
[DEBUG] adding entry META-INF/maven/org.pidac.webservices/axis2test/pom.properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

但是,当我使用7-Zip手动爆炸此AAR时,无法在任何地方找到services.xml 这里的文档Maven2 AAR Plug-in Guide

  

services.xml文件的位置。默认情况下,假设为   文件已经存在于classesDirectory / META-INF中并且没有特殊之处   处理是必需的

但是当我在构建完成后查看classesDirectory时,没有META-INF文件夹。

我错过了什么?

1 个答案:

答案 0 :(得分:0)

需要尝试更多的事情并在各行之间阅读:

此处的文档Maven2 AAR Plug-in Guide需要澄清此插件的servicesXmlFile配置参数,但对我没有帮助。如果您在Eclipse中编辑POM.xml时很幸运能获得Intellisense,那么您将获得有关此配置参数的更好描述:

应该有三种方法来解决这个问题:

  1. 在src / main / resources下创建一个文件夹META-INF并添加您的services.xml。

  2. 在POM项目设置下输入以下配置。

            META-INF         假         $ {BASEDIR} / src目录/主/ web应用/ META-INF                    的services.xml         
          

  3. 在插件的配置设置中输入services.xml的路径,如下所示:

                    org.apache.axis2                 Axis2的-AAR-Maven的插件                 1.6.2                                                                                             Axis2的-AAR:AAR                                                  
                                $ {BASEDIR} / src目录/主/ web应用/ META-INF
                                                                                                       $ {} project.build.directory / AAR                                      /                                 
                                                                                                            

  4. 可能是由错误的路径引起的,我无法让这种替代工作。也许有人可以评论。