2011-02-14 77 views
0

我正在嘗試做一些非常簡單的操作:從Maven運行Ant任務。萬無一失,對嗎?錯誤。Maven未執行我的Ant目標

這裏是我的POM:

<?xml version="1.0" encoding="UTF-8"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 
     xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <artifactId>sampleproject-app</artifactId> 
     <groupId>org.sampleproject</groupId> 
     <version>0.0.1-SNAPSHOT</version> 
    </parent> 

    <groupId>org.sampleproject</groupId> 
    <artifactId>patient-labs-module</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>swf</packaging> 
    <name>Sample Project Patient Labs Module</name> 

    <properties> 
     <flex.sdk.version>4.1.0.16248</flex.sdk.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>com.adobe.flex.framework</groupId> 
      <artifactId>flex-framework</artifactId> 
      <version>${flex.sdk.version}</version> 
      <type>pom</type> 
      <exclusions> 
       <exclusion> 
        <groupId>com.adobe.flex.framework</groupId> 
        <artifactId>playerglobal</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>com.adobe.flexunit</groupId> 
      <artifactId>flexunit</artifactId> 
      <version>4.0-rc-1</version> 
      <type>swc</type> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.adobe.flex.framework</groupId> 
      <artifactId>playerglobal</artifactId> 
      <version>${flex.sdk.version}</version> 
      <classifier>10.1</classifier> 
      <type>swc</type> 
     </dependency> 
    </dependencies> 

    <build> 
     <sourceDirectory>${basedir}/main/flex</sourceDirectory> 
     <testSourceDirectory>${basedir}/test/flex</testSourceDirectory> 

     <resources> 
      <resource> 
       <directory>${basedir}/main/resources</directory> 
      </resource> 
     </resources> 

     <testResources> 
      <testResource> 
       <directory>${basedir}/test/resources</directory> 
      </testResource> 
     </testResources> 

     <plugins> 
      <plugin> 
       <groupId>org.sonatype.flexmojos</groupId> 
       <artifactId>flexmojos-maven-plugin</artifactId> 
       <version>3.8</version> 
       <extensions>true</extensions> 
       <dependencies> 
        <dependency> 
         <groupId>com.adobe.flex</groupId> 
         <artifactId>compiler</artifactId> 
         <version>${flex.sdk.version}</version> 
         <type>pom</type> 
        </dependency> 
       </dependencies> 
       <configuration> 
        <sourceFile>application.mxml</sourceFile> 
        <targetPlayer>10.1</targetPlayer> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-antrun-plugin</artifactId> 
       <executions> 
        <execution> 
         <phase>install</phase> 
         <configuration> 
          <tasks> 
           <mkdir dir="/var/www/sampleproject/patientlabs"/> 
           <copy todir="/var/www/sampleproject/patientlabs"> 
            <fileset file="${project.build.directory}/${project.build.finalName}.${project.packaging}"/> 
            <fileset dir="main/resources" includes="**/*"/> 
           </copy> 
          </tasks> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

我在做什麼錯?當我運行mvn install時,Ant目標永遠不會執行。有一個更好的方法嗎?我只需要將資源目錄和主swf中的某些文件複製到本地目錄,以便我可以在本地主機HTTP服務器上對其進行測試。

回答

2

如果你看一下usage網站Maven的antrun-插件,你會看到,也是一個目標是在插件配置

 <goals> 
      <goal>run</goal> 
     </goals> 

我想你必須添加此規定。

+0

謝謝,我真的需要閱讀我的Maven書:) – 2011-02-14 21:38:52

相關問題