Jenkins Nexus Upload different Repositories with Maven - maven

within Jenkins I use the Plugin for Nexus-Artifact Uploader to load our maven deployed results into nexus.
Not unusual we have different Repositories (Snapshot and Release) in Nexus.
What I like is to determine in Jenkins in which Repository the deployed artefact should be uploaded.
In Jenkins I can configure Parameter for that, but the plugin does not support any of these parameter.
Is the most common way to implement this within the pom.xml or has anybody solved this in the way I try to ?
Thanks in advance!

Nexus-Artifact-Uploader plugin accepts input parameters and environment variables as inputs.
You can create a parameter for ex: RepoType and you can pass value as $RepoType to the repository input field.

Related

adding metadata to artifactory

The problem:
I need to be able to use artifacts/versions that passed specific version CI of 3 different project.
For instance project A version x.y.z passed the pipeline with B version x2.y2.z2 and when building C I need to be able to get the artifact of A and B that passed a specific versions.
Therefore I was thinking of pushing additional metadata to the stored artifact in artifactory and when building C to query the artifactory with the data.
How can I add custom data to artifact stored in artifactory as per the CI pipeline with Jenkins
You can use Artifactory's REST api or the JFrog CLI to easily set properties on an Artifact or an entire Folder.
You can then query Items/Artifacts based on the properties using REST
or CLI using a spec file
for more advanced querying capabilities you can use Artifactory's AQL
Use Maven Artifactory Plugin
https://www.jfrog.com/confluence/display/RTF/Maven+Artifactory+Plugin
to specify custom metadata for the deployment.

Can I resolve dependencies of maven artifacts in artifactory?

We are currently migrating from Nexus to Artifactory and one thing we are missing is an API call to resolve maven dependencies in artifactory. Nexus has this endpoint /service/local/dependency?r=snapshots,releases&c=&e=pom&s=compile&f=list&g=<my.group>&a=<my-artifact>&v=<my-version> which gives a compiled list of all, including transitive, depdendencies.
We need this because we (mis)use maven as a generic deployment/versioning system to create artifacts (zip files of shell scripts actually) and to manage depenedencies. These dependencies are also necessary for production deployments.
Since we migrate from Nexus we don't have builds accessible and I am not yet sure if we want to use them. Is there a way to get a rest endpoint like the nexus one in Artifactory? Maybe a user plugin? Any hints on how this could be done?

How to deploy Neo4j snapshot build to a custom Maven repository?

When I try to build neo4j from sources and deploy it, the deployment phase fails since there is already a repository defined in the grandparent's pom.xml.
Is it possible to redefine (or add) the DistributionManagement properties so that I'll be able to deploy custom neo4j build to an internal non-local repository?
It is possible since maven-deploy-plugin 2.8
Just be sure to use that version of the plugin (by defining it in neo4j's pom if neo4j doesn't already do that by itself)
Then define altReleaseDeploymentRepositoryand/or altSnapshotDeploymentRepository in your maven settings.xml. (Depending on your personal preference you can also define that inside a profile).
The syntax of the alternative repositories is id::layout::url where id must match the id of a server that is also defined in your settings (giving you the chance to give user/pass for that server). Layout is default
Example:
<altReleaseDeploymentRepository>my.nexus::default::https://my.domain.com/nexus/content/repositories/releases/</altReleaseDeploymentRepository>

adding artefacts in Archiva not through its interface

How can I insert artefact in archiva not through its web interface.
It is possible to upload artifacts using maven.
Please refer to the Archiva Users Guide, Section Deploying to Repository for the details.
The following methods are available:
upload via the user interface (I presume this is the one you refer to as the web interface)
connect via any WebDAV client at http://localhost:8080/archiva/repository/repo-name (adjust according to your configuration)
use HTTP PUT with basic authentication to the same location as the WebDAV URL (this is the method that other tools like Maven, Ivy, etc. would use)
drop the file into the correct place in the file system and wait for Archiva's scanner to pick up the changed artefact
As Torsten's answer indicates, uploading using Maven's deploy phase or deploy:deploy-file goals (or equivalent from another build tool) is likely what you want since it will take care of constructing the correct path for the artefact and pushing any associated metadata, assuming you are using Archiva as a Maven artefact repository.
You have an upload screen tru the web ui.
See http://www.youtube.com/watch?v=LSXe26inf0Y

What is a "resolver" when deploying to maven repositories?

We're trying to setup Gradle to publish artifacts to Artifactory. There are two sets of credentials that can be configured, a "deployer" and "resolver". The deployer seems fairly obvious, as the target repository is read-only, a set of credentials are necessary to authenticate for deployment.
However, what is this "resolver" in the context of maven repositories. We are already using Gradle's dependency management, so project dependencies are already getting resolved via the repositories we have configured using Gradle.
So what's the point of this second "resolver" configuration, and why would it need credentials?
Thanks.
If you're using the Gradle Artifactory Plugin, then it allows you to set optional user/pass for a repository that requires authenticated read access (can be set in Artifactory using permission targets).
A maven (or ivy, if configured) repository with these credentials will be added to your project by the plugin behind the scenes.
I think this is needed e.g. if you use your own enterprise repository (like Nexus or Artifactory) and you even need credentials to read that repositories (which may be the case in companies).

Resources