Gradle finds POM for dependency but not JAR - gradle

We are hosting a local maven repository in Sonatype Nexus, in order to share our own jars across projects. We are having an issue with one jar in particular, where Gradle is able to find and download the POM, but not the JAR from Nexus.
The error given in Gradle is simply:
Could not resolve: com.qf:qf-etl_2.11:0.0.1-SNAPSHOT
We have not this problem with any other jar held in Nexus. There is one possibly notable difference between this jar, and other jars we are hosting, which is that this jar depends on another jar which is also held in our locally hosted maven repository.
We are using Gradle 2.14, and Nexus 3.0.1-01 (ESS)
All help and ideas are appreciated, and please let me know what additional information I need to provide!

The POM was downloading without the JAR, because the JAR depended on two unmanaged (3rd party) JARs. The solution that I followed was to upload the third party JARs into Nexus as well, so that these could be found, guided by these instructions
Note that gradle:eclipse was not reporting missing dependencies, even though it would normally do this.

Related

broken classpath with Intellij Idea on maven dependency

i'm using Intellij IDEA 12.1.6, almost everyone in my company use Eclipse and dont notice my problem. We have a local nexus repository where we deploy artifacts, but some of them are systematically created with an invalid maven-metadata.xml (the latest snapshot timestamp and build number does not match the effective artifact name on repo) and intellij ends up telling me those libraries have broken classpath.
Is there a way to force intellij on hooking the maven jars on my local repository without worrying about those metadata additional information? Eg eclipse hook the jar in his classpath taking the version which does not include those data (in my m2 repo dir i see both 2 jars downloaded, the one with full data and the other one without them)
eg.
library-0.0.6-SNAPSHOT.jar
library-0.0.6-SNAPSHOT-20131028.111135-10.jar
Thank you for your help.
If Importing the eclipse project did not work. You should be able to Configure the library contents . The step for Configure Library Dialog should allow you to point the library to a different location.

What is the purpose of the pom.xml inside a jar's META-INF folder?

Typically, a maven built jar artifact will have it's pom included under META-INF. I recently noticed that the Spring jars don't have this. So, that causes me to wonder about the purpose of that pom.
It seems like maven retrieves the pom directly from the repository when it's doing things that require knowledge of the artifacts meta-data, e.g. when determining dependencies.
So, what's the embedded one for?
The Maven docs suggest two reasons for the pom in this location.
1) Merely for reference, as a convenience. As the docs say, it makes the artifact "self describing"
2) You can get at this information from within your application using Java. This enables the arfiact to auto-report it's version within the application.
http://maven.apache.org/guides/getting-started/index.html
The pom you will find in the repository is not necessarily the one used to build the artifact. It is aimed at the users of the artifact and can be customized when building your artifact.
The one included inside the artifact IS the one used to produce the artifact.
There are options to not have it included in the artifact.

Copy two versions of same jar using maven

I am writing pom.xml for our project. I need to copy two different versions of same jar. But I searched maven docs and found that Maven has no support for this. Is there any other way to do that?
Note: Both jars have same groupid and artifact id.Only their versions are different.
Thanks in advance!
As you already know, Maven was designed to make sure that you will never have two JARs with the same coordinate (group + artifact id) but different versions on the classpath.
There is no way to achieve what you want without modifying the POMs of the JARs
So you need a workaround. Here are a couple of solutions:
Give the JARs different classifiers. Typical classifiers are "tests" and "sources" but they can be anything.
Move the version number to the artifact id and give the two JARs a new version.
For all approaches, you will need to download the JARs (and probably their POMs as well) and install them again using mvn file:install (after changing the POMs) or deploy them with mvn deploy:file if you run your own Maven proxy.

Maven and ibiblio

I searched a lot in apache documentation and ibiblio.org and I could not find a decent straight answer.
My questions:
When I download a jar using maven dependency (setup in pom), how can I be sure that the file does not change on the remote repository? for example, if I'm using log4j version 1.2.3, downloaded from ibiblio.org (or any other repo for that matter), how can I be sure I'm getting the exact same jar each time?
Does maven delete jars from the local repository? let's assume I'm not clearing the repository at all, will it fill up eventually? or does maven have some kind of mechanism to clear old jars?
In Maven conventions a released version like log4j 1.2.3 will never be changed. It will be left in your locale repository until you manually delete it. It can't be changed by anyone except for the admins on maven central, but i suppose they don't do such a stupid thing.
Furthermore the download by default is done from maven central (repo1.maven.org/maven2 instead of ibiblio).
One of the "tricks" in Maven is download an artifact (released) only once...that improved your build performance in contradiction to the SNAPSHOT dependencies.
You could configure your own repository, and point all your project poms at that. It's easy to configure your poms to use a different (private) repository, but I've never set one up myself. Doesn't seem too hard, other than managing it to keep all the needed artifacts available.

How to make my maven project depend on non maven projects?

I want to create a maven project, which has to depend on a non maven project which in turn depends on 2 other non maven projects. I do not have ownership of any of the other projects and it would not be possible for me to change anything in those projects let alone the structure to conform to the maven structure.
I asked if I could just get jars -- but was told that because of multiple levels of dependency, it would be "difficult" -- although I haven't understood why.
Is this possible or should I just abandon the use of maven to create my project and go with a regular project with jars in the lib folder?
Inxsible
If you can go with a regular project build that means you must have access to the other project's jar files?
It doesn't really matter how the other project builds them, you can still gain more control over your own build process by loading the jars you depend on into a Maven repository.
I'd suggest using one of the following repository managers:
Nexus
Artifactory
Archiva
They'll give you management screens to uploading 3rd party jars, they'll also a more efficient way to use other Maven repositories like Maven Central.
Once you've got your Maven build process working, you could encourage the other projects to automatically publish their versions into your Maven repo.
They could use the ANT tasks provided by the Maven or Apache ivy projects. Worst case you just continue to load their libraries until they see the light :-)

Resources