Why doesn't the dependency contain a jar in the maven public repository https://mvnrepository.com? - maven

I a maven rookie and am wondering how to get a binary jar file if it is not already in the repo. Specifically i'm in need of: jackson-dataformats-text-2.13.0.jar. Do I need to build it myself? I'm used to creating a project and marking a library as a dependency and seeing the jar downloaded into my .m2 cache but all i see in my cache is:
jchan#jchan-Z170N:~/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformats-text/2.13.0$ ls
jackson-dataformats-text-2.13.0.jar.lastUpdated jackson-dataformats-text-2.13.0.pom.sha1
jackson-dataformats-text-2.13.0.pom _remote.repositories
Can someone advise how I am to get a built version of the jar from maven central?
We are still maintaining our ant build and I need the jar file for this. (i know i know, ancient stuff but team is not ready to port just yet).

parent pom don't contain jar file
This is the reason why no bundle link is present on the official public maven repository https://mvnrepository.com
The maven dependency is not a jar, is a parent. So the extension is: .pom which is just a plain pom.xml
Parent dependencies don't contain compiled class like .jar.
In your specific case, there are another dependencies who contains jars:
https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.0/
https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.13.0/
advice
Check what classes do you need on your ant project and search if exist a jar (with the classes you need) on https://mvnrepository.com
Another option is to get all the dependencies from pom :
https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformats-text/2.9.0/jackson-dataformats-text-2.9.0.pom and download them into your ant project. In theory is the same of add the parent pom in a maven project

Related

Way to include pom.xml with runtime dependencies within a gradle built and published jar

Is there a simple way to have gradle automatically generated a pom file listing the jar dependencies (both to published jars of other sibling projects and external) and have it included in the jar and published to a maven repo?
There is a lot of documentation on this subject but I am either missing something or it is as complicated as it seems. Can this not be done automatically?

How to download with Maven a project jar and its dependencies without checking out the sources

In one Java project, I have configured its POM so maven will generate in the target folder:
the binaries jar.
the sources jar.
the javadocs jar.
the tests jar.
In addition, I configured the POM so Maven downloads all the project dependencies in the target/lib folder.
The project is also uploaded to the Sonatype snapshots repository.
My question is: Is it possible for a user of my library to download all the artefacts mentioned above with one single instruction, without having to checkout the sources of my project first ?
I found in a question from some years ago that just distributing the POM is not enough to download a project and its dependencies.
But I have not lost hope that this could be possible to accomplish in one single step.
When you say "all of the artifacts mentioned above", do you mean:
the binaries jar.
the sources jar.
the javadocs jar.
the tests jar.
or do you mean:
all the project dependencies
Assuming the latter, then have your user do the following:
create a dummy pom.xml file
declare your library as a dependency
use maven-dependency-plugin:copy-dependencies to copy jars into desired location
Hope that helps.

What is the purpose of providing a downloaded pom.xml on mvnrepository.com

On mvnrepositry, when you search for a certain module, there's a link to download the binary. For some versions it has a pom.xml file available for download instead of the jar. What are you supposed to do with that pom.xml? It seems like if I specify a version that does not have a downloadable jar, but instead downloadable pom.xml, my maven build will fail. Is what I'm seeing correct?
Modules that only have pom files are maven modules with pom packaging. They are used to aggregate multiple modules into one unit. You can use such a module as a dependency for your maven project. Maven will download the pom file, analyze the dependencies included in that pom file and download those & add it to your automatically.
Even modules that have jars (jar packaging) have a pom file associated with them. This pom file defines the other dependencies that are required for using it. Maven will automatically process and fetch those dependencies (transitive dependencies).
This makes specifying and managing dependency for any project. You will specify the top level modules that your projects directly depends on and other things required will automatically figured out and downloaded. It also makes it easier when you have upgrade to a new version - all the transitive dependencies will get upgraded automatically.
One of the reason that cause this is because of licensing issue.
License for such JARs prohibit public redistribution in such approach. So someone provide only the POM so that you can get the JAR yourself and install it to your local maven repo/ internal repo, together with the POM provided.

Creating source and doc jars

I've noticed something really cool about the m2eclipse plugin. When I try to view source on one of the class files included by Maven, at first it's unable to show it to me, but then in the background, it downloads a src JAR and a docs JAR. For my own projects how do I make and deploy these JARs alongside my binary JAR in my Maven repository?
You can do this by attaching the source and javadocs as part of your project build. This cookbook has the maven configuration needed for it.
Maven Source Plugin: http://maven.apache.org/plugins/maven-source-plugin/usage.html

maven - how does it work? Missing some some jars

I am trying to move my MyEclipes projects to maven. But of course there are problems. After creating a web priject I get missing jar files - about 5
org.springframework.security jar files e.g. org.springframework.security.ldap-3.0.5.RELEASE
show as missing in the jar build path. They are not in the corresponding .m2 directory. I un-installed ME4S, and deleted .m2, which force .me to be rebuilt on re-install, but it has the same problem.
How do I fix this?
It would be very helpful to understand how the .m2 process works - where is this coming from and how is it controlled?
I am not sure about the MyEclipse part, but this seems to be a pure maven question.
Maven (2/3) uses the pom.xml. This file describe your project. In that file you should define a list of dependencies (which can have their own dependencies and so on).
Maven read the pom.xml and build the classpath accordingly using direct and transitive dependencies.
You can use the mvn dependency:tree command to see how your classpath is built.
More on the plugin page

Resources