.m2/repository
インストール フェーズの前に、リポジトリ全体 ( ) のコンテンツを削除したいと思います。もちろん、手動でやりたくないので、魔法を行うプラグインを探しています。これまでのところmaven-clean-plugin
、次のように使用しようとしています。
<build>
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>${settings.localRepository}/</directory>
<includes>
<include>**/*</include>
</includes>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>auto-clean</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
これにより、新しいアーティファクトをダウンロードする前にリポジトリ全体が消去され、最終的にtarget
モジュールからフォルダーが削除されると予想されます。フォルダーの削除はtarget
機能しますが、リポジトリの消去は機能しません。リポジトリを一掃しますが、maven は必要なアーティファクトが欠落していると不平を言うため、コンパイルは失敗し、次のようなエラーが返されます。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.3:resources (default-resources) on project com.google.protobuf: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.3:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.3 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.3 -> [Help 1]
解決にかなり近づいた気がします。おそらく、プラグインのパラメータ タグを微調整する必要があるだけです。
誰かアイデアを教えてください。