diff --git a/packages/@aws-cdk/assets/lib/asset.ts b/packages/@aws-cdk/assets/lib/asset.ts index ba26f3a737269..a075ef5829be0 100644 --- a/packages/@aws-cdk/assets/lib/asset.ts +++ b/packages/@aws-cdk/assets/lib/asset.ts @@ -88,9 +88,10 @@ export class Asset extends cdk.Construct { this.assetPath = path.resolve(props.path); // sets isZipArchive based on the type of packaging and file extension + const allowedExtensions: string[] = ['.jar', '.zip']; this.isZipArchive = props.packaging === AssetPackaging.ZipDirectory ? true - : this.assetPath.toLowerCase().endsWith('.zip'); + : allowedExtensions.some(ext => this.assetPath.toLowerCase().endsWith(ext)); validateAssetOnDisk(this.assetPath, props.packaging); diff --git a/packages/@aws-cdk/assets/test/sample-asset-directory/sample-jar-asset.jar b/packages/@aws-cdk/assets/test/sample-asset-directory/sample-jar-asset.jar new file mode 100644 index 0000000000000..71224bd574e4b Binary files /dev/null and b/packages/@aws-cdk/assets/test/sample-asset-directory/sample-jar-asset.jar differ diff --git a/packages/@aws-cdk/assets/test/test.asset.ts b/packages/@aws-cdk/assets/test/test.asset.ts index fbfc4cad4a209..c7395deac8634 100644 --- a/packages/@aws-cdk/assets/test/test.asset.ts +++ b/packages/@aws-cdk/assets/test/test.asset.ts @@ -130,10 +130,15 @@ export = { path: path.join(__dirname, 'sample-asset-directory', 'sample-zip-asset.zip') }); + const jarFileAsset = new FileAsset(stack, 'JarFileAsset', { + path: path.join(__dirname, 'sample-asset-directory', 'sample-jar-asset.jar') + }); + // THEN test.equal(nonZipAsset.isZipArchive, false); test.equal(zipDirectoryAsset.isZipArchive, true); test.equal(zipFileAsset.isZipArchive, true); + test.equal(jarFileAsset.isZipArchive, true); test.done(); } };