-
Notifications
You must be signed in to change notification settings - Fork 261
feat(pacmak): Add support for non-Maven Central repository #3893
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -285,6 +285,43 @@ export class JavaBuilder implements TargetBuilder { | |||||||||||||||||
|
|
||||||||||||||||||
| const profileName = 'local-jsii-modules'; | ||||||||||||||||||
| const localRepository = this.options.arguments['maven-local-repository']; | ||||||||||||||||||
|
|
||||||||||||||||||
| const repos = localRepos.map((repo) => ({ | ||||||||||||||||||
| id: repo.replace(/[\\/:"<>|?*]/g, '$'), | ||||||||||||||||||
| url: `file://${repo}`, | ||||||||||||||||||
| })); | ||||||||||||||||||
|
Comment on lines
+289
to
+292
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could simplify this a bit I feel...
Suggested change
If doing this, we can ensure "no collisions" by documenting & encoding that "extra" repo IDs may not have a name starting with |
||||||||||||||||||
|
|
||||||||||||||||||
| let servers = undefined; | ||||||||||||||||||
|
|
||||||||||||||||||
| // Add repository provided by user to support edge cases | ||||||||||||||||||
| // e.g. corporate proxies and other remote repositories | ||||||||||||||||||
| const extraRepositoryId: string | undefined = | ||||||||||||||||||
| this.options.arguments['maven-extra-repository-id']; | ||||||||||||||||||
| const extraRepositoryUrl: string | undefined = | ||||||||||||||||||
| this.options.arguments['maven-extra-repository-url']; | ||||||||||||||||||
| const extraRepositoryUsername: string | undefined = | ||||||||||||||||||
| this.options.arguments['maven-extra-repository-username']; | ||||||||||||||||||
| const extraRepositoryPassword: string | undefined = | ||||||||||||||||||
| this.options.arguments['maven-extra-repository-password']; | ||||||||||||||||||
|
|
||||||||||||||||||
| if (extraRepositoryId) { | ||||||||||||||||||
| if (!extraRepositoryUrl) | ||||||||||||||||||
| throw new Error( | ||||||||||||||||||
| 'Extra repository requested but no URL was provided! Use the --maven-extra-repository-url argument to provide a value.', | ||||||||||||||||||
| ); | ||||||||||||||||||
|
Comment on lines
+307
to
+311
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this maybe be made a single option? Something like Then - is there a use-case for having more than 1 extra repository configured? |
||||||||||||||||||
|
|
||||||||||||||||||
| repos.push({ id: extraRepositoryId, url: extraRepositoryUrl }); | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest turning |
||||||||||||||||||
| servers = { | ||||||||||||||||||
| server: [ | ||||||||||||||||||
| { | ||||||||||||||||||
| id: extraRepositoryId, | ||||||||||||||||||
| username: extraRepositoryUsername, | ||||||||||||||||||
| password: extraRepositoryPassword, | ||||||||||||||||||
| }, | ||||||||||||||||||
| ], | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const settings = xmlbuilder | ||||||||||||||||||
| .create( | ||||||||||||||||||
| { | ||||||||||||||||||
|
|
@@ -302,15 +339,13 @@ export class JavaBuilder implements TargetBuilder { | |||||||||||||||||
| localRepository: localRepository | ||||||||||||||||||
| ? path.resolve(process.cwd(), localRepository) | ||||||||||||||||||
| : path.resolve(where, '.m2', 'repository'), | ||||||||||||||||||
| servers, | ||||||||||||||||||
| // Register locations of locally-sourced dependencies | ||||||||||||||||||
| profiles: { | ||||||||||||||||||
| profile: { | ||||||||||||||||||
| id: profileName, | ||||||||||||||||||
| repositories: { | ||||||||||||||||||
| repository: localRepos.map((repo) => ({ | ||||||||||||||||||
| id: repo.replace(/[\\/:"<>|?*]/g, '$'), | ||||||||||||||||||
| url: `file://${repo}`, | ||||||||||||||||||
| })), | ||||||||||||||||||
| repository: repos, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing passwords over CLI arguments is notoriously risky... There's many avenues through which program arguments may be visible by other parties...
I get that these may be "short-lived" credentials here (so less risky to maybe leak somewhere), but I'd still rather have an alternate (safer?) way to provide the password... Not sure what the typical maven practice there is...
This ultimately makes me wonder if we shouldn't instead allow one to provide a "base" XML maven settings file to use, which can include some repos, credentials, etc... This is just an idea, though... I don't know that Maven settings XML documents allow "extending" others without actually copying + modifying them... Which sounds like a lot of unneeded work.