Why can't I download MysqlConnectionPoolDataSource sources and find javadocs with Maven? - maven

I see that for some jars Maven (m2e) automatically downloads sources and/or javadocs. But not for com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource class in mysql-connector-java ver. 5.1.18.
Why?
Is this my mistake or sources and docs are not on repository? How to check artifact has no sources using http://search.maven.org/ website?

The sources are not delivered into Maven Central by the vendor. I assume MySQL does not like to put the sources of their driver onto Maven Central.
Checking for sources is simple, cause there must be a package called mysql-connector-java-5.1.18-sources.jar which isn't their.

Related

How to include csjdbc.jar as part of maven dependency?

I have been looking for a dependency for csjdbc.jar in Maven repository so that I can build my app using maven and retrieve that jar on the fly. However, I cannot find a dependency in Maven repository related to that jar. Can anyone help, please?
Hopefully you have already resolved this issue.
csjdbc.jar is not listed in maven repositories. If you have composite software installed you can copy the jar from
~\Composite Software\CIS 6.1.0\apps\jdbc\lib
directory to your local machine's maven repository like below with proper versioning:
C:\maven\repository\composite\csjdbc\6.1\csjdbc-6.1.jar
(I have 6.1 jar)

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

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