画像、javascript、css、およびその他の静的リソースを src/main/webapp から特定の S3 バケットにアップロードするs3-webcache-maven-pluginを作成しました。ソースはhttps://github.com/aro1976で入手できます。 /aws-parent .
さらに、WEB-INF/s3-webcache.xmlという名前のマニフェストを作成します。これをサーブレット フィルターで使用して、Web サーバーからS3またはCloudForgeにリクエストをリダイレクトできます。
次の構成を <build><plugins> に配置する必要があります。
<plugin>
<groupId>br.com.dynamicflow.aws</groupId>
<artifactId>s3-webcache-maven-plugin</artifactId>
<version>0.0.2-SNAPSHOT</version>
<configuration>
<accessKey>${s3.accessKey}</accessKey>
<secretKey>${s3.secretKey}</secretKey>
<bucketName>${s3.bucketName}</bucketName>
<hostName>${cloudForge.cname}</hostName><!-- hostName is optional -->
<includes>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.tif</include>
<include>**/*.png</include>
<include>**/*.pdf</include>
<include>**/*.swf</include>
<include>**/*.eps</include>
<include>**/*.js</include>
<include>**/*.css</include>
</includes>
<excludes>
<exclude>WEB-INF/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>upload</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
現時点では、 includesやexcludesなどの構成パラメーターが必要であり、従来の Maven 正規表現を使用できます。
S3に保存されているファイル名は、 SHA-256ダイジェストに置き換えられます。これは、非常に長いキャッシュ ヘッダーと複数の戦争の最適化を可能にするためです。そのため、非常にシンプルで従来のファイル名を SHA- 256 ダイジェスト対応。
https://github.com/aro1976/aws-parent/tree/aws-parent-0.0.1/aws-examples/s3-webcache-exampleのサンプル プロジェクト、特にファイル pom.xml (プラグイン構成を含む) を確認してください) および web.xml (フィルター構成を使用)。