Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
--site-dir ${{ runner.temp }}/site
working-directory: gh-pages
- name: Upload Artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: doc-site
path: ${{ runner.temp }}/site/
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
.
# Upload artifact (we'll tar it up to save time)
- name: 'Upload Artifact: built-tree'
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: built-tree
path: ${{ runner.temp }}/built-tree.tgz
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
yarn package
# Upload artifacts
- name: 'Upload Artifact: release-package'
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: release-package
path: ${{ github.workspace }}/dist/
Expand Down Expand Up @@ -476,7 +476,7 @@ jobs:
# Upload artifact only on main and for latest rosetta
- name: 'Upload Artifact: integtest_aws-cdk-lib'
if: github.ref == 'ref/head/main' && matrix.rosetta == 'latest'
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: integtest_aws-cdk-lib
path: ./node_modules/aws-cdk-lib/dist/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
git add .
git diff --patch --staged > ${{ runner.temp }}/upgrade.patch
- name: Upload Patch
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: upgrade.patch
path: ${{ runner.temp }}/upgrade.patch
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.125.0](https://github.com/aws/jsii/compare/v1.124.0...v1.125.0) (2026-01-05)


### Bug Fixes

* **jsii-pacmak:** `--mvn-*` arguments aren't passed through ([#5018](https://github.com/aws/jsii/issues/5018)) ([68642d1](https://github.com/aws/jsii/commit/68642d1b5819cba4fc253ddb7d546c0e9315f961))

## [1.124.0](https://github.com/aws/jsii/compare/v1.123.0...v1.124.0) (2025-12-30)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"rejectCycles": true
}
},
"version": "1.124.0",
"version": "1.125.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
106 changes: 64 additions & 42 deletions packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ import {
findLocalBuildDirs,
TargetOptions,
} from '../target';
import { subprocess, Scratch, slugify, setExtend, zip } from '../util';
import {
subprocess,
Scratch,
slugify,
setExtend,
zip,
ShellOptions,
} from '../util';
import { VERSION, VERSION_DESC } from '../version';
import { stabilityPrefixFor, renderSummary } from './_utils';
import { toMavenVersionRange, toReleaseVersion } from './version-utils';
Expand Down Expand Up @@ -100,11 +107,12 @@ export class JavaBuilder implements TargetBuilder {
);
scratchDirs.push(tempSourceDir);

await resolveMavenVersions(tempSourceDir.directory);

// Need any old module object to make a target to be able to invoke build, though none of its settings
// will be used.
const target = this.makeTarget(this.modules[0], this.options);

await target.resolveMavenVersions(tempSourceDir.directory);

const tempOutputDir = await Scratch.make(async (dir) => {
logging.debug(`Building Java code to ${dir}`);

Expand Down Expand Up @@ -348,7 +356,7 @@ export class JavaBuilder implements TargetBuilder {
return filePath;
}

private makeTarget(module: JsiiModule, options: BuildOptions): Target {
private makeTarget(module: JsiiModule, options: BuildOptions): Java {
return new Java({
arguments: options.arguments,
assembly: module.assembly,
Expand Down Expand Up @@ -449,13 +457,57 @@ export default class Java extends Target {

public async build(sourceDir: string, outDir: string): Promise<void> {
const url = `file://${outDir}`;
const mvnArguments = new Array<string>();

await this.invokeMaven(
sourceDir,
['deploy', `-D=altDeploymentRepository=local::default::${url}`],
{
retry: { maxAttempts: 5 },
},
);
}

/**
* Run the maven 'versions:resolve-ranges' plugin
*
* Initially, we generate version ranges into the pom file based on the NPM
* version ranges.
*
* At build time, 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.
*/
public async resolveMavenVersions(directory: string) {
const versionsPluginVersion = '2.20.1';
await this.invokeMaven(
directory,
[
`org.codehaus.mojo:versions-maven-plugin:${versionsPluginVersion}:resolve-ranges`,
],
{
retry: { maxAttempts: 1 },
},
);
}

private async invokeMaven(
directory: string,
args: string[],
options?: Omit<ShellOptions, 'cwd'>,
) {
// Pass through jsii-pacmak --mvn-xyz=... arguments as --xyz=...
const passThruArgs = new Array<string>();
for (const arg of Object.keys(this.arguments)) {
if (!arg.startsWith('mvn-')) {
continue;
}
mvnArguments.push(`--${arg.slice(4)}`);
mvnArguments.push(this.arguments[arg].toString());
passThruArgs.push(`--${arg.slice(4)}`);
passThruArgs.push(this.arguments[arg].toString());
}

await subprocess(
Expand All @@ -464,21 +516,21 @@ export default class Java extends Target {
// If we don't run in verbose mode, turn on quiet mode
...(this.arguments.verbose ? [] : ['--quiet']),
'--batch-mode',
...mvnArguments,
'deploy',
`-D=altDeploymentRepository=local::default::${url}`,
...args,
...passThruArgs,
'--settings=user.xml',
],
{
cwd: sourceDir,
cwd: directory,
env: {
// Twiddle the JVM settings a little for Maven. Delaying JIT compilation
// brings down Maven execution time by about 1/3rd (15->10s, 30->20s)
MAVEN_OPTS: `${
process.env.MAVEN_OPTS ?? ''
} -XX:+TieredCompilation -XX:TieredStopAtLevel=1`,
...options?.env,
},
retry: { maxAttempts: 5 },
...options,
},
);
}
Expand Down Expand Up @@ -4056,36 +4108,6 @@ function removeIntersections(x: spec.TypeReference): spec.TypeReference {
return x;
}

/**
* Run the maven 'versions:resolve-ranges' plugin
*
* Initially, we generate version ranges into the pom file based on the NPM
* version ranges.
*
* At build time, 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.
*/
async function resolveMavenVersions(directory: string) {
const versionsPluginVersion = '2.20.1';
await subprocess(
'mvn',
[
`org.codehaus.mojo:versions-maven-plugin:${versionsPluginVersion}:resolve-ranges`,
'--settings=user.xml',
],
{
cwd: directory,
retry: { maxAttempts: 1 },
},
);
}

/**
* Whether the given property or method needs to be implemented on a $Proxy class
*
Expand Down
Loading