Maven central repository: Any friendly way to browse artifacts? - maven

I'm new to maven. Now I'm learning how to find and use libraries from maven repository. I see the maven central repository (mcr) as similar to cpan, just mcr is for java and cpan is for perl.
I see a big difference between mcr and cpan: When I search for something (for example "ssh") in the cpan web, I get a brief description of the packages found (what they are and what they do). And if I click on the packages link, then I get the full description (name, sypnosis, description, examples, etc).
Now, if I search for something (for example "ssh") in the mcr web, I get the list of artifacts found, their groupid, version and date, but there is no description on what an artifact is or what it does. Even if I click on the links (version link is the only one that gives some information), I don't get any description on what it is or what it does or examples.
Is there any way (i.e. some other page) to browse the repository artifacts in a more friendly way? (something similar to cpan)

You can use the mvnrepository website.
It is linked to the Maven Central Repository, and provides a more detailed view for each of the artifacts - including descriptions*.
So for example for the commons-httpclient artifact it has the following description:
The HttpClient component supports the client-side of RFC 1945 (HTTP/1.0) and RFC 2616 (HTTP/1.1) , several related specifications (RFC 2109 (Cookies) , RFC 2617 (HTTP Authentication) , etc.), and provides a framework by which new request types (methods) or HTTP extensions can be created easily.
*Note, the descriptions shown are taken from the <description> tag from the artifact's pom. This tag is optional, which means not every project actually defines it, so unfortunately you might not always see a description.

Take a look at Bintray's jcenter. It is a superset of Maven Central and adds metadata on packages, such as author, license, description, release notes, ratings and reviews etc. You can also register to get updates on version releases.

Related

How to assume bintray ownership of a repo copied from maven central

Bintray jcenter has copied my maven central artifacts into their repository. I would like to be able to assume ownership, in bintray, of the package, so that I can edit the description and/or hyperlinks and/or other metadata, all of which is currently empty in bintray. However, the form to request ownership does not work, when you try to send, it gives an error stating some field is missing (without stating which field). Any ideas?
You can't link packages if you are a trial user. So this might also be an issue if you want to take ownership. If that is not the case then I would contact Bintray support.
This is now resolved. In the end I needed to create a user on bintray, then create a repository for that user, and then that allowed me to select both of those things for the form requesting ownership.
As a newbie to bintray/jcentral none of this was clear or obvious, nor do they do these things for you, nor do they allow you to request ownership first so that they can inform you of these necessary steps to complete. So it's not particularly user-friendly.

specify custom location of maven security-settings.xml file?

with maven you can easily specify settings.xml location, e.g:
mvn -s custom/dir/settings.xml package
Is there a similiar way to specify custom security-settings.xml?
The reasoning behind this is simple: to easily distribute it via a local repository. Now, security is NOT a concern - it's all on the intranet.
This was requested as MNG-4853. Although not implemented directly, a workaround is suggested:
I've verified that -Dsettings.security=path/to/security-settings.xml works
As detailed in the announcement blog post, you can also use the master password relocation feature. Write an ~/.m2/security-settings.xml file with a redirection in it:
<settingsSecurity>
<relocation>/Volumes/mySecureUsb/secret/settings-security.xml</relocation>
</settingsSecurity>

Adding a "project health" attribute to pom.xml for 3rd party dependency monitoring

I am working with an organisation that has a large set of projects, all managed by maven (with some custom plugins) and all with a pom.xml.
While most of the projects are developed internally, some of the projects are external (e.g. open source) projects that come with their own POM.
I've been tasked with adding some tags to these external project POMs that can be used by an internal project reporting tool (see this question) to report on these "external" projects, that provides a URL to the project's website and a short statement on the "health" of the project (e.g. mailing list is active, no signs that the project is about to die).
For the project's URL, I expect that I can use the URL provided in the Organization section.
Can I just add "projectHealth" and "status" tags to the organization section? e.g.
<organization>
<name>Codehaus Mojo</name>
<url>http://mojo.codehaus.org</url>
<status>external</status>
<projectHealth>
Mailing list at http://archive.codehaus.org/lists/org.codehaus.mojo.dev is 404.
Mailing list at http://markmail.org/list/org.codehaus.mojo.dev is active.
Project seems active.
</projectHealth>
</organization>
Then I can detect "external" projects via the "status" tag and publish the health statement in my report.
I mean, this won't break any other plugin, will it?
Or is there an existing protocol that is preferred?
pom.xml tags and structure are defined by an xsd (you can see it on top of every pom.xml : xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd)
This xsd is very strict and don't give you the freedom to add tags here and there without breaking something.
The strategy used by standard project reporting plugins to allow customization of reports is to use a bundle file (i.e. not the pom.xml) (example here). So I suggest you to do the same for your internal reporting tool.
An alternative could be to put information inside the project description tag in a format that your tool is able to parse. I mean something like this
<description>
STATUS:external
MAILING LIST: http://archive.codehaus.org/lists/org.codehaus.mojo.dev
MAILING LIST: http://markmail.org/list/org.codehaus.mojo.dev
COMMENT: Project seems active
</description>
Unfortunately, it will pollute existing description and you won't have any static validation on that content.

How to search public Maven/Ivy repositories for a particular class?

There are web sites like http://mvnrepository.com/ letting to search for an "artifact" and giving a definition I can add to my project for a library to be downloaded automatically from a public repository.
But this particular example (mvnrepository.com) (the only working I know actually) is by-definition limited to "search by group, artifact or description" while I would like to search by a class full name. For example I'd like to enter org.apache.commons.lang.NotImplementedException to get <dependency org="commons-lang" name="commons-lang" rev="2.6"/> (or alike) as the answer. Is there a facility for this?
If you like to search for Classes you should use http://search.maven.org and click on "Advanced search"...This is for Maven Central
The answer of #khmarbaise is straight and correct, but if you possibly want to search over few additional public Maven repos (like JBoss), not only Maven Central, I recommend using http://grepcode.com.
EDIT: Unfortunately it seems http://grepcode.com, I used to strongly recommend for such a stuff, is dead now. Currently I don't know a better place than https://search.maven.org, already answered by #khmarbaise.
I suggest to try all the search engines. Now I've lost hours thinking of how to upload an artifact, while it turned out to be already present in the repo. This is junit-addons, which is both groupId and artifactId, as can be verified in pom. My attempts:
http://mvnrepository.com - no
http://search.maven.org - yes
http://grepcode.com - no
http://jarfinder.com - yes, but only a direct download, not for maven
I am a maven newbie, so I cannot state that the second link is the best. Although tt was the only helpful in my case.
https://javalibs.com/ is a good online site to search maven repos.
One more search engine: JAR-Download.com:
The class search page: Search classes in the Maven repository.
For the sake of reference, the archived search page: Search classes in the Maven repository.

Property Replacement in Maven Site Content

I'm generating maven site content using the site plugin. I want to have a little table that shows my maven group id, artifact id, parent info, etc on the module. I don't see a plugin for it, so I was going to use the APT format and create a content page with a table for it. The documentation says I can use property replacement in the site descriptor via ${project.name} etc. This fails when i use it in both the descriptor and in my index.apt file. Has anybody seen this done or know how to do it?
The mvn site command generates a Project Summary page which has this information on it. Does that work for you?
For example, when I execute mvn site, get an output here target/site/project-summary.html where the page has a section like so:
Build Information
Field Value
GroupId com.a.b
ArtifactId myapp
Version 1.01.13-SNAPSHOT
Type jar
If you want to create pages which use placeholder like ${project.version} etc. you need to use index.apt.vm (velocity files) wher the replacement works. But for the information you have asked the solution which has been described (project-summary.html) is the right way cause it's automatically generated.

Resources