2012-06-30 29 views
1

Maven的高手們,請幫助新手在這裏:的Maven2 AAR Eclipse插件不增加的services.xml到AAR

我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中,當我運行一個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文件夾。

我錯過了什麼?

+0

首先我假設目標叫做aar而不是「axis2-aar:aar」。此外,如果您調用mvn clean install,則軟件包生命週期階段已經運行。 axis2-aar:aar目標的添加沒有意義。只需簡單地使用mvn clean package並檢查目標文件夾即可。 – khmarbaise

+0

在調試配置中輸入'aar'會導致編譯問題。在POM中輸入這個內容,什麼都不做,所以它看起來像'axis2-aar:aar'是需要傳遞的。改變我的目標順序來清理axis2-aar:aar install,再次使用Debug Configuration,除了沒有看到aar被爆炸的輸出外,沒有改變任何東西。有趣的是,足夠的services.xml被添加到.war。 –

回答

0

所需嘗試更多的東西,在字裏行間:

文檔這裏Maven2 AAR Plug-in Guide需要澄清servicesXmlFile配置參數此插件並沒有幫助我。如果你是幸運的在Eclipse中編輯pom.xml的時候能得到智能感知,你會得到此配置參數更好的描述:

應該有三種方式來解決這個問題:

  1. 創建一個文件夾META -inF在src/main/resources下並添加你的services.xml。

  2. 在POM項目的設置下輸入以下配置。

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

  3. 輸入路徑的插件配置設置的services.xml,像這樣:

    org.apache.axis2 axis2-aar-maven-plugin 1.6。2 的axis2-AAR:AAR
    $ {BASEDIR}/SRC /主/ web應用/ META-INF
    $ {project.build.directory}/AAR /

可能是由不正確的路徑引起的,我無法得到這個替代方案。也許有人可以評論。