【问题标题】:Maven not executing my Ant targetMaven 没有执行我的 Ant 目标
【发布时间】:2011-02-14 20:38:39
【问题描述】:

我正在尝试做一些非常简单的事情:从 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 中的某些文件复制到本地目录,这样我就可以在我的 localhost HTTP 服务器上对其进行测试。

【问题讨论】:

    标签: maven ant maven-antrun-plugin flexmojos


    【解决方案1】:

    如果您查看 maven-antrun-plugin 的 usage 站点,您会发现插件配置中也指定了一个目标

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

    我想你必须添加这个。

    【讨论】:

      猜你喜欢
      • 2016-09-16
      • 2012-03-25
      • 2011-04-24
      • 2019-01-12
      • 2011-11-06
      • 1970-01-01
      • 1970-01-01
      • 2017-08-06
      • 1970-01-01
      相关资源
      最近更新 更多