[英]Compiling LESS CSS with Maven and m2e-wtp
我正在嘗試使用lesscss-maven-plugin在純maven(帶命令行)和Eclipse(Juno)中編譯LESS CSS文件。
在lesscss-maven-plugin中,我需要定義一個輸出目錄,但是我注意到在Eclipse WTP中,我從服務器(JBoss)中的target/m2e-wtp
復制文件,但是該目錄被Maven的war插件忽略了。 。
我使用Maven概要文件成功實現了目標:在Eclipse中,我使用了在Project設置中配置的m2e
概要文件,因此我可以定義兩個不同的目標文件夾,具體取決於是否在Eclipse中構建。
這是我的pom.xml:
<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>com.dgadev.motd</groupId>
<artifactId>motd</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>7</maven.compiler.source>
<maven.compiler.target>7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
....
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<outputDirectory>${project.build.directory}/resources/css</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>m2e</id>
<build>
<plugins>
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<outputDirectory>${project.build.directory}/m2e-wtp/web-resources/resources/css</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
這行得通,但是有沒有更好的方法來執行此操作而沒有配置文件技巧?
我發現了另一種使用較少編譯器的解決方案:wro4j。 使用此編譯器,既存在maven插件又存在m2e插件。 另外,可以在此處找到教程(用於構建boostrap): m2e-wro4j
您提供的相同解決方案,更加簡潔:
https://github.com/marceloverdijk/lesscss-maven-plugin/issues/8
m2e配置文件由m2e變量激活,因此您不必選擇它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.