mavenで条件付きでプロパティを設定したいのですが、それはスナップショットビルドであるかどうかによって異なります。擬似コードは次のようになります。mavenで条件付きでプロパティを設定する
if ${project.version} ends with "-SNAPSHOT"
then
deployFileUrl = ${project.distributionManagement.snapshotRepository.url}
else
deployFileUrl = ${project.distributionManagement.repository.url}
これはどのように実装できますか?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>regex-properties</id>
<goals>
<goal>regex-properties</goal>
</goals>
<configuration>
<regexPropertySettings>
<regexPropertySetting>
<name>deployFileUrl</name>
<value>${project.version}</value>
<regex>.*-SNAPSHOT</regex>
<replacement>${project.distributionManagement.snapshotRepository.url}</replacement>
<failIfNoMatch>false</failIfNoMatch>
</regexPropertySetting>
</regexPropertySettings>
</configuration>
</execution>
</executions>
</plugin>
を次のように私はビルドヘルパーのmaven-pluginのでそれを試してみました。このアプローチの問題は、私は他の条件を実装することができないということです。
を次のように最後に、私は(http://maven.apache.org/guides/introduction/introduction-to-profiles.html)[プロファイルのビルド]のmaven-antrun-プラグインを使用して終了あなたの答えです。 – biziclop
@biziclopは悲しいことです。 Mavenはアリのようなものではありません。論理をすることは本当に決して考えられませんでした。 Mavenでスクリプトを作成する場合は、Maven Antプラグインを使用してみてください。 – Richard
@biziclopスナップショットであるかどうかに基づいて対応するプロファイルを有効にする方法が必要です。他の条件が存在する場合は... –