Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for using custom .m2 directory #3573

Merged
merged 9 commits into from
Jun 13, 2022
6 changes: 6 additions & 0 deletions packages/jsii-pacmak/bin/jsii-pacmak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ import { VERSION_DESC } from '../lib/version';
// This is expected to be a path, which should be normalized
normalize: true,
})
.option('java-use-default-m2', {
type: 'boolean',
desc: 'Use default M2 repository when packaging a Java package.',
default: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have set the default to false for this setting to maintain backward compatibility. I am wandering whether this should be defaulted to true in future as I am not sure what negative side effects there would be by using the user's .m2 repository.

hidden: true,
})
.option('validate-assemblies', {
type: 'boolean',
desc: 'Whether jsii assemblies should be validated. This can be expensive and is skipped by default.',
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ export class JavaBuilder implements TargetBuilder {
],
// Do *not* attempt to ask the user for stuff...
interactiveMode: false,
// Use a non-default local repository to isolate from cached artifacts...
localRepository: path.resolve(where, '.m2', 'repository'),
// Use a non-default local repository (unless use-default-m2 arg is provided) to isolate from cached artifacts...
localRepository: !this.options.arguments['java-use-default-m2'] ? path.resolve(where, '.m2', 'repository') : undefined,
// Register locations of locally-sourced dependencies
profiles: {
profile: {
Expand Down