application.xml
ファイル フィルターを使用して生成されたファイルをフィルター処理しようとしていmaven-ear-plugin
ます。私のプロジェクト構造は Maven の標準です。
これが私のPOMファイルです:
<?xml version="1.0" encoding="UTF-8"?>
<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>test</groupId>
<artifactId>test-filter</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<properties>
<prop1>xyz</prop1>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<version>6</version>
<env-entries>
<env-entry>
<env-entry-name>env1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>${prop1}</env-entry-value>
</env-entry>
</env-entries>
</configuration>
</plugin>
</plugins>
</build>
</project>
ここまではすべて正常に動作します。プラグインは、補間された値を持つエントリをapplication.xml
含むファイルを生成します。env1
xyz
問題は、Maven プロパティprop1
をプロパティ ファイルに移動してフィルターを構成する場合です。
<?xml version="1.0" encoding="UTF-8"?>
<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>test</groupId>
<artifactId>test-filter</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<build>
<filters>
<filter>src/main/filters/filter.properties</filter>
</filters>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<version>6</version>
<env-entries>
<env-entry>
<env-entry-name>env1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>${prop1}</env-entry-value>
</env-entry>
</env-entries>
</configuration>
</plugin>
</plugins>
</build>
</project>
この機能についての私の理解ではfilters
、プロパティと同等ですが、別のファイルを使用しています。それにもかかわらず、生成されたには補間なしapplication.xml
のエントリが含まれています。env1
${prop1}
もちろん、ファイルsrc/main/filters/filter.properties
は存在し、含まれています:
prop1=abc
足りないものはありますか?