bamboo deployment to nexus repository manager
Asked by Deepak Kumar:

Hi,

To put it simply. I have a src file, with pom.xml file in it. My job consist of the follow task

Source code checkout , and build using maven x3. Now the question is i want to push this artifact to nexus oss repository manager. How can this be done? i do not see solutions for this.


Answers:
author: Lasse Langhorn
body: Hi,

You should configure your Maven 3.x task with a goal like this:

```
clean install -U deploy
```

This assumes that the Maven executable you are using are configured to deploy to your Nexus repo.

Regards

Lasse Langhorn

comments: author: Deepak Kumar
body: Hi thank you ! :)

The above worked for me. However, i will not be using pom.xml all the time.

I found this following script below:

if ((Test-Path -Path ${bamboo.build.working.directory}\\uploadcheck.ps1) -ne "False") {

echo "script not found"

throw -1

}

. "${bamboo.build.working.directory}\\uploadcheck.ps1"

uploadart "${bamboo.ship.buildmaster.username}" "${bamboo.ship.buildmaster.password}" "${bamboo.build.working.directory}\\${bamboo.app.name.01}\\" "WebApplicationMVC.zip" "${bamboo.nexus.artifactrepository.url}/${bamboo.nexus.artifactrepository.id}/${bamboo.nexus.artifactrepository.groupid}/${bamboo.app.name.01}/${bamboo.version}/WebApplicationMVC.zip"

uploadart "${bamboo.ship.buildmaster.username}" "${bamboo.ship.buildmaster.password}" "${bamboo.build.working.directory}\\${bamboo.app.name.02}\\" "WebApplicationSample.zip" "${bamboo.nexus.artifactrepository.url}/${bamboo.nexus.artifactrepository.id}/${bamboo.nexus.artifactrepository.groupid}/${bamboo.app.name.02}/${bamboo.version}/WebApplicationSample.zip"

uploadart "${bamboo.ship.buildmaster.username}" "${bamboo.ship.buildmaster.password}" "${bamboo.build.working.directory}\\${bamboo.app.name.03}\\" "WebAPI.zip" "${bamboo.nexus.artifactrepository.url}/${bamboo.nexus.artifactrepository.id}/${bamboo.nexus.artifactrepository.groupid}/${bamboo.app.name.03}/${bamboo.version}/WebAPI.zip"

uploadart "${bamboo.ship.buildmaster.username}" "${bamboo.ship.buildmaster.password}" "${bamboo.build.working.directory}\\${bamboo.app.name.04}\\" "WebApplicationCore.zip" "${bamboo.nexus.artifactrepository.url}/${bamboo.nexus.artifactrepository.id}/${bamboo.nexus.artifactrepository.groupid}/${bamboo.app.name.04}/${bamboo.version}/WebApplicationCore.zip"

uploadart "${bamboo.ship.buildmaster.username}" "${bamboo.ship.buildmaster.password}" "${bamboo.build.working.directory}\\${bamboo.app.name.02}\\" "WebApplicationSQL.zip" "${bamboo.nexus.artifactrepository.url}/${bamboo.nexus.artifactrepository.id}/${bamboo.nexus.artifactrepository.groupid}/${bamboo.app.name.02}/${bamboo.version}/WebApplicationSQL.zip"

Can this be used in the script task? for the deployment of artifact to nexus oss repo? Thank you.


author: Lasse Langhorn
body: Hi,

I have worked with powershell, mostly shell scripts, so I guess you will have to do some experiements with the setup.

Regards

Lasse Langhorn


author: Deepak Kumar
body: Hi,

I have not played around with scripting, any advice how i should move forward?

How do i understand the above? no help is given in the internet. If i were to write in powershell, any tips how will it be?

Thank you and Regards,  
Deepak Kumar


author: Lasse Langhorn
body: Hi,

Sorry for not being specific. I have not worked with powershell that much. I assume your Bamboo server is running on a Windows machine.

Deploying to Nexus is best achieved by using Maven so if you are not using Maven all the time you will have to create some kind of script that can deploy your artifacts to Nexus.

But please consider using Maven when deploying to Nexus, it will make your life a lot easier. If same Java projects do not use Maven then consider using Maven.

Regards

Lasse Langhorn


author: Deepak Kumar
body: Hi,

Thank you for the prompt reply ! The reason why is because i am using .NET projects and .Net framwork project, so i have to use PowerShell. Do you think you could guide me where to begin? totally stuck. Thank you ! Appreciate it truly. I will accept your answer too.


author: Lasse Langhorn
body: Hi,

Take a look at this link: <https://confluence.atlassian.com/bamboo/getting-started-with-net-and-bamboo-289277288.html?_ga=2.164363071.1613866103.1587364475-558906917.1567757958>

It might give some ideas on what to do next.

Regards

Lasse Langhorn