내 웹 프로젝트의 디렉토리에서 LESS CSS 전처리기를 실행하도록 maven을 설정하려고합니다. 기본 흐름은maven-antrun-plugin에서 foreach 호출
- 입니다. Maven은 maven-antrun-plugin을 호출합니다.
- Ant-contrib
<foreach/>
디렉토리를 통해 반복하고 모든 .less 파일을 찾고 대상을 호출합니다. - 대상은 파일을 변환하는 LESS를 실행하는 Rhino를 실행합니다.
이렇게하려면, 나는 다음과 같은 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>
"메인"대상이 실행되기 시작하지만 <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 line:
[ERROR] /Users/.../pom.xml:4: Unexpected element "{http://maven.apache.org/POM/4.0.0}project" {antlib:org.apache.tools.ant}project
[ERROR] around Ant part ...<foreach param="file" target="processLessFile">... @ 6:50 in /Users/.../target/antrun/build-main.xml
[ERROR] -> [Help 1]
Ant에서 뭔가가 POM 파일을 읽으려고 시도하여 대상을 찾고있는 것처럼 보입니다. 두 대상 모두 target/antrun/build-main.xml 파일과 target/antrun/build-processLessFile.xml 파일에 생성되므로 두 디렉토리를보고 있어야하는 디렉토리입니다.
개미가 아닌 개미가 아니라는 뜻입니까? –
고마워, 나는 계속 잘못 입력했다. –