相关疑难解决方法(0)

在maven-antrun-plugin中调用foreach

我正在尝试设置maven来在我的web项目中的目录上执行LESS CSS预处理器.基本流程是:

  1. Maven调用maven-antrun-plugin.
  2. Ant-contrib <foreach/>循环遍历目录并查找所有.less文件并调用目标.
  3. 目标执行Rhino,执行LESS转换文件.

为此,我有以下XML:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <configuration>
                        <target name="processLessFile">
                            <!-- ... -->
                        </target>
                        <target name="main">
                            <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath"/>
                            <property name="css.dir" location="src/main/webapp/css"/>
                            <foreach param="file" target="processLessFile">
                                <fileset dir="${css.dir}">
                                    <filename name="**/*.less" />
                                </fileset>
                            </foreach>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>ant</groupId>
                    <artifactId>ant-contrib</artifactId>
                    <version>1.0b2</version>
                </dependency>
            </dependencies>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是"主"目标开始执行但后来失败<foreach>:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project model-web-project: An Ant BuildException has occured: The following error occurred while executing this …
Run Code Online (Sandbox Code Playgroud)

ant ant-contrib maven maven-antrun-plugin

5
推荐指数
1
解决办法
6985
查看次数

标签 统计

ant ×1

ant-contrib ×1

maven ×1

maven-antrun-plugin ×1