How can I specify in pom.xml a dependency to a project in a repository? - maven

I have a project working on my Spring Tool Suite. Also, I have a project in an innersource repository that I want to use in my project of STS.
For that, I need to specify the dependency in the pom.xml file of my project to establish the dependency with this remote project. But I don't know how to specify this dependency and what information about the remote project I need to put in the pom and where I can find it.
At least I need what information I should write in the pom and I will look wherever for that information.
Thank you so much for your help!

A best practice is to use your own / company wide Maven Repository Manager such as Nexus and define a single repository group.
Use this Maven Repository Manager to share closed source artifacts (hosted repository) and to access Open Source repository such as Maven Central (proxy repository).

Related

why are the github projects of spring-boot-starter projects empty?

On looking at the spring-boot-starter-web, spring-boot-starter-security projects on github, i find them to be empty with just a build.gradle file present there.
I hope this is as expected, but this leads me to understand where the actual source code can be found. And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
I hope this is as expected
This is as expected. Spring Boot's starter modules exist purely to being multiple dependencies together into a convenient "package". For example, if you want to write a Servlet-based web application using Spring MVC and Tomcat, a single dependency on spring-boot-starter-web provides all of the dependencies that you need. You can learn a bit more about the starters in the reference documentation.
Where the actual source code can be found
The majority of the code can be found in spring-boot-autoconfigure. For more production-focused features, you'll also find some code in spring-boot-actuator-autoconfigure. The code in these two modules is activated automatically when the dependencies that it requires are on the classpath. You can learn more about this conditional activation and auto-configuration in the reference documentation.
And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
Spring Boot is built with Gradle which, unlike Maven, completely separates the configuration needed by the build system to build the project and the information needed by a build system to consume the project. The build.gradle files provide all of the information that Gradle needs to build the project. As part of this, it generates Gradle module metadata files and Maven pom.xml files that contain all of the information needed to consume the project with Gradle and Maven respectively. These generated files are then published to Maven Central alongside the jar files, source code, etc.

External Custom library for Gradle project

I am building a SpringBoot application in which i want to handle some of the cross cutting concerns like logging, caching, persistence in to a project on its own so in future other rest spring boot components can adopt it and use it as a dependency.
I am using Gradle for dependency management. My question is :-
How can i manage this concerns without publishing it to the public artifactory.
If i have to publish then which is the free artifactory i can use for my development practice
If creating jar is an option as a temp solution then how can it be achieved via gradle. Most of the examples over the internet is for creating the executable jar files.
What are the other options i can try.
How can i manage this concerns without publishing it to the public artifactory.
Publishing has to happen regardless where it will be published to. You can use a private solution such as Nexus Repository.
If i have to publish then which is the free artifactory i can use for my development practice
For development, you can simply publish to your local Maven repository. This is typically ~/.m2. Using the Maven Publish plugin, you can easily publish locally by invoking the publishToMavenLocal task.
If creating jar is an option as a temp solution then how can it be achieved via gradle. Most of the examples over the internet is for creating the executable jar files.
Since you're creating a Spring Boot library, use the Java Library plugin to create the JAR artifact and in combination with the Maven Publish plugin to publish.
In the end, there are 2-3 key components that get published when using Gradle:
JAR artifact
pom.xml: https://maven.apache.org/pom.html
Gradle Module Metadata: https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html

Adding external private jar to Openshift Application

I want to deploy a Java & Maven micro services application on OpenShift however I have one small issue. These micro services are dependent on a commons project
containing some common components.
How can i add the jar of the commons project ( private jar, not on public repo) to the class path of the micro services about to be deployed on Openshift?
When building the application locally we used a maven plugin which would move the jar of the commons project into the local maven repository, from where it was easily referenced via a dependency tag in the pom file.
Here are some approaches that I thought about:
use an internal maven repository
create a folder on the root of the project and use it as a local maven repo, declaring it via repository tags in the pom files
deploy a nexus repository on the Openshift cluster
The first approach is not viable since our company does not have an internal maven repository.
We also tried the third approach , however we did not manage to deploy a running nexus repo on Openshift.
The only viable solution left is the second one, however I am a little bit reluctant to implement it since it does seem to be the standard way of doing things. What approach would you reccommend?
create a folder on the root of the project and use it as a local maven repo, declaring it via repository tags in the pom files
This won't be a good approach TBH.
My recommendation would be using a nexus/jfrog etc. repo OpenShift internal or externally (a more recommended approach for enterprises) and get the commons and other libraries from that repo via defining maven dependencies.

Is there a Maven repository for Solace artifacts?

I'm trying to find out whether there is a Maven repository for Solace artifacts. From what I've checked, these are not available via Maven Central. We'd like to proxy these via our Nexus repository manager. If they aren't available, I suppose we'll have to add them to our third-party hosted repository. I'm just checking what the proper course of action should be.
Any advice would be much appreciated!
Solace Systems does not currently provide a Maven repository for Solace artifacts. I recommend adding the Solace JARs manually to your repository.
The JARs are contained in their associated API package. You can find the download links for these API packages on the Solace developer portal.
Edit: Solace does now provide a Maven repository for Solace artifacts as of December 2016.
Now its available. Please find the details in this link .

Migrate maven artifacts into Cloudbees repository

Has anyone ever migrated an existing maven repository into Cloudbees repositories?
Currently, I have a self-hosted Sonatype Nexus instance with three custom repositories (snapshots, releases, and 3rd-party libraries not hosted in Maven). I have an existing Cloudbees CI environment, and I'm looking at migrating my maven storage as well.
If anyone has any helpful hints, tips, or an existing migration guide, please point me in the right direction.
Thanks in advance.
The simplest way would be to zip/tar.gz up your existing repository and upload it to the DAV repository in question.
Submit a support request and it can be unpacked on the server (DAV is quite slow for moving lots of files)

Resources