私のようにディレクトリ構造を持っている:CSSの3つの別々のディレクトリがありますのmaven-戦争 - プラグイン:すべてのディレクトリを除外するが、1つの
src
|__ main
|__ java
|__ resources
|__ webapp
|__ css_blue
|__ css_green
|__ css_red
|__ WEB-INF
(css_red
、css_green
、css_blue
など)。ここで、私はとして-D
スイッチに基づいていずれか一方のみを含める:
mvn clean install -Dcss=green
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.faisal.dwr</groupId>
<artifactId>chatbox</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- Spring - MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<!-- Spring Web Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- Spring Security Config -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- DWR -->
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<version>3.0.0-RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingIncludes>css_${css}</packagingIncludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
しかし、この場合にはWEB-INF
下のファイルとディレクトリは、最終的な.war
ファイルに存在しません。
これは魅力的です。助けてくれてありがとう! '%regex []'で動作することを説明できますか? –
@MohammadFaisal '?!'は "ネガティブルックアヘッド"と呼ばれます。私はこの構造についての質問にリンクしました。これは、別の文字列で始まらない文字列と一致します。 – Tunaki
eclipseからの依存関係の更新中にこの式を追加した後に直面する問題 - 'Mavenプロジェクトの更新中に内部エラーが発生しました。 –