Mavenモジュールには、複数のリソースフォルダーがあります
src/main/prod/sql
およびsrc/main/dev/sql
。製品には、大量のデータ挿入がある本番用のスクリプトがあります。プロファイルローカルがアクティブ化されている場合、prod / sqlディレクトリ内のいくつかのファイルをdev / sql内のファイルで上書きする必要があります。
これが構成です
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-files</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${basedir}/target/classes/sql</outputDirectory>
<resources>
<resource>
<directory>src/main/dev/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
クリーンインストールでmodileをビルドすると、ターゲットディレクトリにprod / sqlのスクリプトが常に存在します。私が間違っていることを教えてもらえますか?ありがとうございました。
で構築しmvn clean install
ますか?
その場合、<activeByDefault>true</activeByDefault>
パラメータはlocal
デフォルトでプロファイルの実行を許可していません。ビルド中にプロファイルmvn clean install -Plocal
をロードするビルドを使用する必要がありますlocal
または、pom.xml
常にlocal
プロファイルを使用するように変更します。
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
...
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加