Maven hosting with Bintray - maven

I am having issues with hosting maven jars with Github (site-maven-plugin) so I want to move with Bintray asap.
What are the steps to host a existing maven jar in bintray?
Here is my error when doing: mvn releae prepare
Caused by: org.apache.maven.shared.release.ReleaseFailureException: You don't have a SNAPSHOT project in the reactor projects list.
What I have now is I can do mvn clean install with no problems at all. Can I just upload the files under ./m2 repo? I basically uploaded the .jar and .pom I found in the maven repository.
How can I access the library I uploaded on Bintray from my pom.xml?

You can get started with publishing from Maven to Bintray by copy-pasting some pom parts from "Set Me Up" guide:
Full user manual is available as well.
Please note, that you can't upload SNAPSHOTs to Bintray. It's a distribution platform and it is not intended for development process.
Saying that, you are welcome to take advantage of a free Artifactory account for hosting your snapshot during development.
Using OJO you don't need to use the troublesome Maven Release Plugin anymore. Once you're satisfied with the snapshots quality you can promote them to be releases and upload them to Bintray in one REST call (or click of a button in Jenkins),

Related

Bintray, JCenter, Maven, MavenCentral, OSSRH, Sonatype, Nexus, how are they all related?

I have a library shared in JCenter, which I post to through Bintray.
Recently, it is announced JCenter and Bintray are sunsetting, and many advised us to go to MavenCentral. I'm looking to move migrate it over.
Then I notice within the Bintray, it is stated my library is on Maven too, and the user can get my library using
maven {
url "https://dl.bintray.com/elye-project/maven"
}
So I'm confused, does that means I am already in Maven? Is this is just another name for JCenter and will not be available as well?
As I read more, I found an article stating we can publish our library from Bintray to MavenCentral too.
I also read if I need to submit my library to MavenCentral, I need to first create an issue in Sonatype.
Then I saw Sonatype is actually having Nexus Repository Manager. Then I find OSSRH uses Nexus Repository Manager.
I am super confused about what these terms are, and how are they related?
Bintray, JCenter, Maven, MavenCentral, OSSRH, Sonatype, Nexus.
Can someone give a brief description about them, and help to connect the dot for me?
MavenCentral is the place where Java open source artifacts should be published
JCenter was such a place.
Maven is a build system, not a repository. Many repositories have Maven format, which makes them readable from Maven and Gradle.
Sonatype Nexus and JFrog Artifactory are repository managers. You can install them to manage internal and external artifacts on your own server, which is advisable inside a company.

Deployed Maven Attached Artifacts on Github Remain Inaccessible

I have a maven module which is configured with a feature packaging (an Apache Karaf feature). This project has no primary artifact to deploy but an attached feature.xml file. When I try to deploy the project to Github package the upload seems to work:
Uploaded to github: https://maven.pkg.github.com/cdelg-ct/repo/com/mycompany/app/my-mod/1.0-SNAPSHOT/my-mod-1.0-20200701.090836-1-features.xml
But then, the above file does not show up in the Github Packages UI and other projects cannot depend on it (Could not find artifact). Note the pom is well deployed as the other sibling jar modules.
Did anyone manage to get classifier to work with Github Maven Packages?
You are using a SNAPSHOT version.
By default, SNAPSHOT versions are not fetched.
Quick way to check it, try a release version.
If it works, you have to configure your maven settings to allow spapshots versions.

How to get an artifact in Maven Central show up in JCenter

I have published a small library to Maven Central (it can be downloaded via web UI here). This was done more than a full day ago.
My understanding is that JCenter mirrors Maven Central, but for some reason I cannot find my artifact in JCenter both via web interface and as part of Maven build.
Do I need to take some action to make it appear in JCenter too?
Basically, if you want to make sure that your library will exist in JCenter, you can upload your library to Bintray under Maven repository, and request to add it to JCenter.
Bintray can also save you the trouble of uploading your library to Maven Central, and do it for you.
Enjoy
Two weeks later the artifact is now visible in JCenter. Apparently it just takes some time to appear there.

Moving a project to Maven Central

I manage many maven projects. Most of them deploy to our internal maven repository. Now I would like to start releasing one project to Maven Central. Up until now, I have had a parent POM that specified the distributionManagement of our internal repository. It doesn't make sense to deploy this information to Maven Central.
How should I specify the distribution management for my internal projects? Should I have a seperate parent pom group-internal for internal projects?
Sonatype mentions a way to deploy directly to their repositories, but they recommend using their own parent pom (oss-parent). Looking at projects using mvnrepository.org, I couldn't find any projects with oss-parent as the parent. Do most project manually deploy their artifacts to Sonatype? Where and how do they deploy them first?
So many questions! I'm amazed at how complicates this is...
Update: it turns out some of the projects I identified do use oss-parent. It's just hidden as it's the parent of a parent.
Once you are all set up, you can deploy staged releases and SNAPSHOTs directly to Sonatype's OSS repository. Stages releases can then be released through Sonatype's Nexus UI.
To create a repository folder for your application to which you can deploy, you open a ticket with Sonatype on their JIRA along with a reference to the open-source project you will deploy. The process is very smooth and Sonatype will help you if you don't supply all the necessary information.
While on first glace it doesn't look like many projects have oss-parent as a parent, they often do when you navigate up the POM tree. For example, Google Guava has the parent guava-parent, which has the parent oss-parent. Once your project has oss-parent and the repository is configured, you can easily deploy SNAPSHOTs and releases with mvn deploy or mvn release:prepare release:perform.
It seems overwhelming, but it's easily understood if you just plow through the steps for the first time.
The first I recommend to read is the following:
https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
The OSS parent makes under special circumstance sense under other not. That depends what kind of project you like to distribute.
UPDATE: That link is dead now. Look here for help deploying to Sonatype.
UPDATE: For Maven Central check this: http://central.sonatype.org/

How to enable inside glassfish access to maven repository?

I have a following problem. We have a central maven repository hosted on our company server. Our team is working on a project. Everyone here uses that repository to get the required artifacts. If something is missing at the moment and is required for the task that the developer is currently dealing with, he installs this artifact manually to the central repository, so that his commits don't break the automated builds.
Now, each developer also has Glassfish v2 installed on his machine. That is for testing and debugging purposes. Before committing the changes, developer makes the .ear for the project with Maven help. However, after the developer deploys the ear to it's local glassfish, frequent errors arise, because the set of glassfish libraries may not contain all the latest dependencies of the central company repository.
Right now in case of the error the developer simply reads the log and looks what exactly is missing. After that he manually copies the required jar inside his local $GLASSFISH_HOME$/lib dir. But that seems a little bit frustrating. How can this be done automatically?
Right now we are trying to implement the following solution. The developer has to synchronize his local maven repository gathering all the artifacts from the central one that are required by the project. This local repository has to be placed on the java classpath, so that glassfish would also see it. Is that a correct approach? Maybe there is a way to install directly all the required artifacts from the central repository inside $GLASSFISH_HOME$/dir and this can be done automatically during deploy?
About having to install dependencies. If the developers need to install dependencies missing from public maven repositories, take into account that usually maven proxies have the ability to cache public repos. For instance, archiva has a proxying cache. If the dependencies are your own project deliverables you should consider releasing and deploying with maven to your company repo.
About latest versions. You need to specify maven what version of dependencies should use. I would prefer editing my poms manually, anyway there's a variety of ways to achieve that.
The libraries should be part of the project, I think. If not standard libraries of glassfish, they should be included, for instance, in your war file as part of your project. If not standard but not part of your project (not the regular approach) consider managing this glassfish as a project on its own (own git/svn repo, own pom, own versions, own everything).
Good luck.

Resources