Upload non java artifacts to nexus 3.1.0-04 - file-upload

I want to be able to upload a non java artifact to hosted nexus3 repository. For this I used the curl commands described in this link uploadToNexus, but it worked only for nexus 2. I noticed also that we can create groovy script, upload them to nexus and run them (RestApi, but I'm not sure if we can create a groovy script to upload artifacts. Is there a groovy script giving this possiblity ? I'm wondering also if there is any non maven alternative to the maven deploy plugin ?
Thanks in advance.

If it's a non Java artifact, you might look at using our RAW repository, depending on what it is. However, if you for sure want to use a Maven repository, the good news is you can :)
Assuming you have a fairly normal local setup, go with something akin to this. The big change between Repository Manager 2 and 3 is that the endpoints changed, which is why the old commands are not working for you.
curl -v -u admin:admin123 --upload-file file.jar http://localhost:8081/repository/releases/org/foo/1.0/file.jar

Related

How to transport a Selenium package to a client environment?

I need to develop a automation package using selenium and send it over to a different location and completely different environment so that it will aid in the testing's happening there. It has to be able to be integrated with Jenkins for the build run. Also it should be a data driven package.
how will I be able to do that?
You need to create repository and upload the tests there and provide access to the client. You can use service like Github or Gitlab. You can have private repository for up to 3 contributors.
You can parametrize the test using property file or system property variables.
If you need more information about how the system properties work you can check this article: https://www.baeldung.com/java-system-get-property-vs-system-getenv
Something like this:
System.getProperty("log_dir", "/tmp/log");
mvn clean test -DpropertyName=value
If you want to send the project like a jar file then it will be like:
System.getProperty("baseUrl", "https://mywebsite.com");
java -jar jarName -DbaseUrl=https://someotheraddress.com

Can I deploy bamboo.yml YAML specs manually?

I am trying to learn how YAML specs works in Bamboo. So far I achieved to deploy the plan following the official documentation. enter link description here
The documentation explains that you need to create a bitbucket repository, create bamboo.yml, set a new project in bamboo, enable a bamboo specs repository and finally you get your plan created and based in YAML specs.
My question is, can I create a plan.yml and deploy it from other bamboo plan?
For example, for JAVA specs, it is enough to checkout a repo with several *.java specs files and use maven and a pom file to deploy all the plans.
Can I do something similar with YAML specs? To have a folder in some SCM with several *.yml files and deploy them simultaneously. As a result, to have a lot of plans in bamboo deployed and based on the yml files.
yes and no, yaml can't be sent to the server as you can do with java specs. It needs to be committed to the repo first
you also need to have your different project created prior to committing the yaml specs and or have that repo granted access to each individual project or enabled the flag on the linked repo to allow access to all projects in the specs tab.
if this is not an issue,then yes there is no problem defining multiple plans in your bamboo specs yml file, even across multiple projects, as long as they are split up in separate yaml documents (with "---")

How to add custom jar in Apache Ivy

Our application has a custom jar trades.jar and I want to upload it to local Apache Ivy repository. How should I do it.
I know in maven it can be done using command 'mvn deploy:deploy'
For an ivy publish example see:
Issues using ivy:publish task
And if you want use a command-line solution:
good ivy tutorial for local repository?
Quite similar with ant/ivy, you are looking for ivy:publish

Maven command to install remote dependency locally

I have a base pom which defines repository locations for the nexus we are running behind our firewall and all of our projects inherit from this base pom. However the base exists in one of the repositories defined in the base, so you can see the circular reference problem. I'd like a maven install:install-file like command I can have new team members run in order to pull down and install the base project locally without having to check the project out from source control and mvn install it.
I'd like a maven install:install-file like command I can have new team members run in order to pull down and install the base project locally without having to check the project out from source control and mvn install it.
The Maven Dependency Plugin and its dependency:get goal might help here, you could do something like this:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-Dartifact=groupId:artifactId:version[:packaging] \
-DrepoUrl=http://repository.mycompany.com/
But let me come back on the following:
However the base exists in one of the repositories defined in the base (...)
Unless this is really what you want (adding a repository for thing not found in central), this is usually not how people declare a Nexus repository in a corporate environment.
People usually want all requests to go though their Nexus repository and store artifacts in it. Storing all the artifacts you need yourself is the only way to be sure that you'll be able to repeat your build in 1, 5, 10 years. Sure, the maven folks are doing a great job with central but are you sure you want to rely on something not under your control? So people usually declare Nexus as a mirror of everything (check the section 4.2. Configuring Maven to Use a Single Nexus Group) in the settings.xml.
And if you don't want every user to add the required snippet in their ~/.m2/settings.xml, the best option is to distribute and use a corporate version of the Maven client and to preconfigure it as required using the conf/settings.xml file.
References
Nexus User Guide
Chapter 4. Configuring Maven to Use Nexus

private internal maven repository

I wonder whether I can setting up a private maven repository based on my svn.
The svn can be accessed via http.
If yes, then what should I do? Just uploading the architypes is enough?
If yes, then what should I do? Just uploading the architypes is enough?
While subversion is not really made for that, yes, Maven can deploy through WebDAV so it is possible (a lot of people are actually doing this for their google-code projects).
If you want to set this up for an existing maven project (and have the created artifacts deployed to your SNV repository during the deploy phase), adapt the solution described in Hosting a Maven repository on Google Code.
If you just want to add a particular artifacts, use the deploy:deploy-file goal:
mvn deploy:deploy-file \
-DrepositoryId="internal" \
-Durl="dav:https://server/repo" \
-Dfile="some-jar.jar" \
-DgroupId="my.groupid" \
-DartifactId="my-artifactid" \
-Dversion="1.2.3" \
-Dpackaging=jar \
-DgeneratePom=true
Under GNU/Linux, you can paste this command as is; under Windows, run it on one line without the \.
The question shouldn't be can you but should you. Yes you can. No you shouldn't. Instead of using a tool designed to manage source diffs for binary storage, instead get an artifact repository manager like Nexus to manage the binaries. Repository managers have tons of features designed especially to host, share, promote, secure binaries that you don't find in a typical scm. For example an scm has no capability to appropriately deal with maven snapshots.
If you want more information about why you should use a repository manager, take a look at the documents here.