正規表現に基づいてMavenのプロパティを置きたい。そのために私はregex-property
プラグインを使用しています。プロパティはスペースで区切られたエントリを含み、それぞれからxml "ノード"を作成する必要があります。ビルドヘルパーのエスケープ置換値を無効にする:regex-property
"C:\some\entry D:\another\entry"
(processing here ... below is the content of variable after processing)
<fileset dir="C:\some\entry" includes="*.myext" />
<fileset dir="D:\another\entry" includes="*.myext" />
置き換えプロパティは、後で与えられた成果物をコピーするために使用する必要があります。ここ
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>regex-property</id>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>testprop</name>
<value>${testprop}</value>
<regex>([^\s]+)</regex>
<replacement><fileset dir="$1" includes="*.myext" /></replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
しかし、問題をreplacement
があるということである。
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>copy files</id>
<phase>initialize</phase>
<configuration>
<tasks>
<copy todir="${project.basedir}/somedir">
${processedPaths} <!-- THIS WILL EXPAND TO <fileset ... /> -->
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
私はほとんど働く何かを持っています途中でどこかで逃げた。結果として得られるプロパティには<fileset dir\="C\:\\some\\entry" includes\="*.myext" />
が含まれますが、これは望ましくありません。
このアプローチは厄介なようですが、プロパティで指定されたディレクトリからファイルをコピーできるような方法はありませんでした。