純粋な Maven (コマンドラインを使用) と Eclipse (Juno) の両方で、lesscss-maven-pluginを使用して LESS CSS ファイルをコンパイルしようとしています。
lesscss-maven-plugin では、出力ディレクトリを定義する必要がありますが、Eclipse では WTP がサーバー (JBoss) からファイルをコピーすることに気付きましたtarget/m2e-wtp
が、このディレクトリは Maven の war プラグインによって無視されます。
Mavenプロファイルで目標を達成することに成功しました。Eclipsem2e
では、プロジェクト設定で構成されたプロファイルを使用するため、Eclipseでビルドするかどうかに応じて2つの異なる宛先フォルダーを定義できます。
ここに私の 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>
これは機能しますが、プロファイルのトリックなしでこれを行うより良い方法はありますか?