Maven pom to zip config files from GitHub and jars from artifactory - maven

Requirement:
Need to push config files and jars from artifactory to UCD for deployment.
Config files are present in GitHub repostiory.
Jars (not needed for build but needed to start application in UCD) are present in artifactory.
What would be the general process to follow, in order to copy config files from github and download/copy jars from artifactory and package everything in a zip file to push to UCD?

You might consider:
the maven download plugin to get the files you need from an URL (like a GitHub repository or an Artifactory one)
the maven assembly plugin to build your archive
configuring on UCD side the source of your Nexus package to deploy, although there is a urbancode plugin maven-ibmucd which could be handy (not tested)

Related

How to download selective dependencies using Maven from JFrog Artifactory?

I have a simple Maven project and its pom.xml has some dependencies to some local jar files inside the project structure. Now I want to upload those local jar files in JFrog Artifactory and change the pom in such a way so as to use selective dependencies from Artifactory and rest of the Pom files remains the same like it was(which includes some spring boot, Junit, surefire dependencies etc etc). How can I alter the pom file so that I can selectively download those jars from Artifactory rather than from my local machine.
I uploaded the local jars in a folder in Artifactory but unable to configure my pom/maven to download those during clean install. I tried as per the documentation in Jfrog to modify the settings.xml and include the server tag and aslo added distribution management in pom.xl to refer to the Jfrog Artifactory. But this is for all the dependencies no? I want selective dependencies to be downloaded from Artifactory.

Backup Maven dependencies to repository

I am frequently using maven artifacts as dependencies from external repositories which go (permanently) offline surprisingly often. I'd like to save all dependencies a given project has and save them in a local repository - just like using maven deploy -DaltDeploymentRepository=... for a single project. This repository should then be usable like any other maven repo when put on an HTTP server.
I tried using mvn dependency:copy-dependencies -Dmdep.useRepositoryLayout=true, but it does not create files like maven-metadata.xml or copy .pom files.
I do not want to use any repository managers like Artifactory, I just have a static file server.
Thanks in advance.

How do I find out my Maven deploy directory?

I have my source code in Git and use Maven to deploy it to an Archiva repo.
I somehow don't exactly know where my deploy directory is. I would like to copy a kar file there so that it can be deployed when Jenkins builds it.
your deploy directory is groupId/artifactId/version depending in wich repository you deployed (SNAPSHOT,release, or thirdpary), generally you should build in a different project your kar file and then use as a dependency in the other project.
You shoud not copy any files in a repository without a pom.xml.
Or you can just deploy with deploy:file

Maven / OSGi: deploying to an OBR which is not the maven repos

My maven build installs artifacts locally and requires access to the project's remote maven repository. I don't have write access to that repository - so my builds (containing my changes) are only local so far.
When I build, I would like to deploy the .jar to a remote OBR which I have control over. This is not a full maven repository (eg. Nexus), just a webserver. A repository.xml describing the OBR should be automatically generated and uploaded.
Simply calling the goal "deploy" will try to upload to the project's maven repo, which fails as I don't have write access.
I want:
build & install locally, getting all dependencies on remote maven repos as required
upload jars to the OBR
generate repository.xml OBR description and upload
How should I configure the maven-bundle-plugin? Which goal must I call?

Publishing artifacts with sources on archiva

At work I'm dipping my toes in managing project dependencies with maven. We use Apache Archiva (1.2.1) as a local repository and proxy. I'm adding artifact for open source project, that is not published on any public repository. I've learned that to publish the sources I should use the Classifier field on Upload artifact page. The sources are then listed alongside the jar and pom when I browse the repository.
But when I update my maven dependencies I get only the jar and pom from the repository. I noticed that sources are also missing when the archiva proxies for me the downloads from other public repositories. I didn't find any configuration options in Archiva's admin pages to serve the sources... What am I missing?
Update: I was missing the fact that artifact sources have to be downloaded manually. I.e. the maven client has to request them, which is controlled by command line option -DdownloadSources=true. Maven Integration for Eclipse has a preference setting to always download them as described in Resolving artifact sources. Archiva then serves the sources for local artifacts or proxies the request to remote repositories and caches the sources for future requests.
Archiva does serve the sources, but Maven does not request them by default. I know since I also use Archiva as my Maven repo. How are you requesting the sources?
If you're using eclipse
you can run mvn eclipse:eclipe -DdownloadSources=true in the project directory;
you can install the Maven Integration for Eclipse.
Both of them should return the sources if they are available.
The sources aren't required to satisfy compile/runtime dependencies. If you wanted to bundle sources with your app, then you would specify a dependency with a source. Or you would use a plug in like assembly to grab them from archiva.

Resources