Skip to content

Commit ecdd223

Browse files
authored
fix(java-runtime): dependency ranges make Maven download too many files (#5005)
Given a dependency version range, Maven will download metadata for all possible versions before every (uncached) build. This takes a long time, before finally resolving to the latest version anyway. Instead, we use the Maven 'versions' plugin to resolve our wide ranges to point versions. We want the "latest matching" version anyway, and if we don't the resolution now (which downloads the .poms of all possible versions) it will happen during every single build. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
1 parent 018396e commit ecdd223

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/@jsii/java-runtime/generate.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
set -euo pipefail
33
project="./project"
4+
versions_plugin_version=2.20.1
45

56
mkdir -p conf
67

@@ -14,3 +15,11 @@ mkdir -p ${project}/src/main/resources/software/amazon/jsii
1415
rsync -av $(node -p 'require("path").dirname(require.resolve("@jsii/runtime/package.json"))')/webpack/ ${project}/src/main/resources/software/amazon/jsii
1516

1617
/usr/bin/env node ./BundledRuntime.t.js > ${project}/src/main/java/software/amazon/jsii/BundledRuntime.java
18+
19+
# Use the Maven 'versions' plugin to resolve our wide ranges to point versions.
20+
# We want the "latest matching" version anyway (*), and if we don't the resolution
21+
# now (which downloads the .poms of all possible versions) it will happen during
22+
# every single build.
23+
#
24+
# (*) Consumers can still override versions in their own poms.
25+
(cd $project && mvn org.codehaus.mojo:versions-maven-plugin:${versions_plugin_version}:resolve-ranges)

0 commit comments

Comments
 (0)