NexuShell - a PowerShell CLI for Nexus Repository - Sonatype Nexus Repository - Sonatype Community

NexuShell - a PowerShell CLI for Nexus Repository

post by steviecoaster on Nov 27, 2023

I work for Chocolatey Software and as such I need to build repository servers…a LOT. I got tired of manual effort and clunky scripts so I created NexuShell, a PowerShell wrapper module for the Nexus Repository API. It’s not got 100% parity with the API, but it certainly could with some effort and maybe even some community involvement! I’d be more than happy to answer questions about it here, or if you’d like to try it out, it is on the PowerShell gallery, and you can install it from there. It’s also available as a Chocolatey package, and you can install it that way with choco install nexushell -y

post by daniel.harris on Nov 28, 2023

I’m getting a 404 on the repo. Is it open to the public?

post by steviecoaster on Nov 28, 2023

Whoops, I had a typo in the link! Fixed now, thanks for pointing that out!

post by mleighfield on Dec 4, 2023

Hi Steve, I have installed using choco install nexushell -y. Is there a readme or any usage info available please?

post by steviecoaster on Dec 4, 2023

The link to the docs in my initial post is your best bet I think! Also all the commands have help available via Get-Help $cmdletName

post by mleighfield on Dec 6, 2023

Thanks for that. When I try to build I get the following in PowerShell:

PS C:\NexuShell-develop\NexuShell> .\build.ps1 -Build

Chocolatey v2.2.2

Installing the following packages:

gitversion

By installing, you accept licenses for the packages.

Progress: Downloading GitVersion 1.0.0.1… 100%

GitVersion v1.0.0.1

GitVersion package files install completed. Performing other installation steps.

The install of GitVersion was successful.

Software installed to ‘C:\ProgramData\chocolatey\lib\GitVersion’

Chocolatey installed 1/1 packages.

See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Install-Script : A parameter cannot be found that matches parameter name ‘PassThru’.
At C:\NexuShell-develop\NexuShell\Requirements.ps1:14 char:61
- ```
$Install = Install-Script Install-RequiredModule -Force -PassThru

CategoryInfo : InvalidArgument: ( [Install-Script], ParameterBindingException FullyQualifiedErrorId : NamedParameterNotFound,Install-Script

Join-Path : Cannot bind argument to parameter ‘Path’ because it is null. At C:\NexuShell-develop\NexuShell\Requirements.ps1:15 char:25

$Script = Join-Path $Install.InstalledLocation $Install.Name


CategoryInfo : InvalidData: ( [Join-Path], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

The expression after ‘&’ in a pipeline element produced an object that was not valid. It must result in a command
name, a script block, or a CommandInfo object.
At C:\NexuShell-develop\NexuShell\Requirements.ps1:17 char:3
- & $Script -Path $PSScriptRoot\RequiredModules.psd1

CategoryInfo          : InvalidOperation: (:) [], RuntimeException
FullyQualifiedErrorId : BadExpression

Build-Module : The term ‘Build-Module’ is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\NexuShell-develop\NexuShell\build.ps1:40 char:13
- ```
Build-Module -SemVer $SemVer

CategoryInfo : ObjectNotFound: (Build-Module:String) [], CommandNotFoundException


Please advise.

Thank you.

Mark

## post by steviecoaster on Jan 3, 2024

Hey Mark,

Sorry for the delay!

This is available on the PowerShell Gallery: `Install-Module NexuShell` and

Chocolatey: `choco install nexushell -y`

You’ve highlighted some good gaps in the docs I’ll work to get patched