Can't download snapshot artifacts when version is specified by range - maven

In POM could be specified wanted range of artifact version (which in next step will be downloaded by maven-dependency-plugin:copy-dependencies):
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>hibi-test</artifactId>
<version>[0.1.4-SNAPSHOT,0.2.0)</version>
</dependency>
Problem is that hibi-test has NO releases on my Nexus, - only few SNAPSHOTS (locked timestamp snapshots). I've checked this POM on artifacts which have both releases and snapshots and it worked good, but in that case I've got only:
[ERROR] Failed to execute goal on project Test: Could not resolve dependencies for project my.group:Test:pom:0.0.1-SNAPSHOT: Could not find artifact my.group:hibi-test:jar:0.1.4
Snapshot repository in POM is defined.
I've tried various combination of range, enabling snapshots and versions:unlock-snapshot, but it didn't work. When I passed only 0.1.4-SNAPSHOT artifact hibi-test-0.1.4-SNAPSHOT.jar was downloaded correctly.
What I need here? :)

is 0.2.0 the latest version?
Maybe you should try to change your range of versions.
Try this:
<version> [0.1.4,0.2.0) </version>

Related

Maven Build Not Finding Oracle

I'm switching a maven project's db from MySQL to Oracle. I have this dependency in my pom.xml:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
But IntelliJ's maven view shows red squigglies on that dependency and mvn clean install gives me:
Could not resolve dependencies for project com.example:polls:jar:0.0.1-SNAPSHOT: Failure to find com.oracle:ojdbc6:jar:11.2.0.1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
So per this advice, I did a force (mvn clean install -U). But that gives me:
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.pom
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2.0.1.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.jar
... even though my .m2 does contain that dependency:
So why does my project not build? Is there some reason Oracle jars are not accessible via maven central?
It turns out Oracle JDBC drivers need to be obtained from the "Oracle Maven Repository". There's lots of guidance on that, which I guess I missed at first. They can also be downloaded directly.

Cannot resolve the SNAPSHOT dependency deployed via Maven deploy-file

I have a problem with Nexus dependency resolution. Nexus version is 3.13.
I have a project "A" which is used as a library across different projects.
I am trying to create
- SNAPSHOT versions to be used for DEV environment
- RELEASE versions will be used after code freeze and to deploy other environments.
I deploy the project "A" as a snapshot to a maven hosted repository(jar file, snapshot repository). I tried "deploy plugin" 3.0.0-M1 and 2.8.2 with uniqueVersion=false. But every time a timestamp is added to the artefacts in Nexus(jar and POM files). I have no issue with timestamp but I cannot resolve the project from other projects.
When I use "LATEST" as the version then the following is the response
"The POM for filename:jar:X.Y.Z-SNAPSHOT is missing, no dependency information available". The POM and JAR is in the repository, but the POM file contains the timestamp suffix as well.
I don't have any problems with release repository for the same project.
Any idea?
Edit :
I used uniqueVersion only for version 2.8.2, for the others there is already an error(or warning).
To deploy project "A", I use the following maven command
mvn deploy:deploy-file -Dfile=target/my-library-0.0.X-SNAPSHOT.jar -DpomFile=pom.xml -DrepositoryId=nexus -Durl=http://my-ip-address/repository/my-library-snapshots.
The POM contained almost nothing actually the usual IDs and a dependency to Lombok.
From the project B, I use only the following
<dependency>
<groupId>Some Group IDs</groupId>
<artifactId>my-library</artifactId>
<version>LATEST</version>
</dependency>
Instead of LATEST, I also tried expilicitly giving version number in nexus.
I found the issue. It was related to my settings.xml file. I added another element under "profile" element called "id"
<profiles>
<profile>
<id>nexus</id>

artifactory force update of remote repos

I have had a working artifactory for over a year now. I have set up a virtual repo that has my local (company) artifacts, along with the maven repo (https://repo1.maven.org/maven2) and a few others.
I have a working spring boot app, and I am simply updating to the new 2x version (Currently 2.0.0.M6) my POM parent looks like this:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
When I try and do a mvn install -U I get an error:
[FATAL] Non-resolvable parent POM for org.springframework.boot:myProject:[unknown-version]:
Could not find artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.M6 in central (http://xxx/artifactory/myVirtualRepo/) and 'parent.relativePath' points at no local POM # line 9, column 12
Now when I change that back to my original version (1.5.7.RELEASE) it works fine.
If I manually go and check my artifactory, I do NOT see a 2.0.0.M6 version there. So the error makes sense, but how do I get my Artifactory to "update" or whatever, the newer versions listed on maven central?
Well I am not seeing the artifact you are looking for in Maven central :-)
According to https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/, the artifact's latest version is 1.5.9
If you look at https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent, you can see that the 2.0.0-MX versions are only available on the springio-milestone mirror.
You probably need to add another remote repository that relies on http://repo.spring.io/milestone/, and add it to your virtual repository.
This should fix it.

Nexus doesn't download the complete artifact content from the Central repository

In our project we use the artifact
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>1.7.5</version>
</dependency>
Everything works fine: Nexus downloads the same content as in http://repo1.maven.org/maven2/nl/jqno/equalsverifier/equalsverifier/1.7.5/ to its proxy repository.
('Download' column in artifact details on Nexus shows 'pom, jar')
Now, we switch to the newest version 2.0.2 of the artifact:
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>2.0.2</version>
</dependency>
Then, when we try to build the project then the attempt fails. Nexus cannot resolve the artifact! It seems like Nexus didn't download the complete content of the artifact version ('Download' column in artifact details on Nexus shows 'pom, pom'). On the other site, when I look at the artifact in the Central repository, the content is as usual: http://repo1.maven.org/maven2/nl/jqno/equalsverifier/equalsverifier/2.0.2/.
What causes the problem with the newest artifact version? Why can't Nexus download it correctly?
You may have overlooked that your dependency is of type pom. This will only download the pom, because that's what you are asking for. Remove the <type> and you should get the jar aswell.
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>2.0.2</version>
<type>pom</type> <-------------- Remove this
</dependency>
Assuming crea1's answer didn't solve your problem:
Maybe something went wrong when Maven downloaded the artifact, causing Maven to "think" the artifact was downloaded anyway.
You can force Maven to try and download it again with mvn -U test.
If that doesn't work, try going into ~/.m2/repository (or wherever Maven stores its artifacts locally on your system), locating EqualsVerifier, removing the entire 2.0.2 folder, and calling Maven again.

Best way to create maven project to upload missing jars in central repository

ProGuard version 4.5, 4.5.1 and 4.6 have been released, but unfortunately, the corresponding maven artifacts have not been released in central repository:
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version> <-- This is the limit
<scope>runtime</scope> </dependency>
I have left a message on Proguard's forum for more information. I am considering releasing them myself since Eric Lafortune mentioned he is not involved with maven anymore.
Instead of recompiling the code, I was wondering whether it might be possible to create a maven project to install existing jars (available from sourceforge) into the central repository. This is different than installing external jars in a local repository.
How can I configure my pom.xml to achieve this assuming those jars are available in my local repository? Is this possible?
The next step would be to use Sonatype's repository as a stepstone to release the artifacts into central repository.

Resources