1

I have a separate project, which I assemble into a jar file, and connect as an external dependency to my main project.

External project pom.xml

<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<version>0.9.2</version>
<name></name>
<packaging>jar</packaging>

The command to place the jar file in a local repository.

mvn deploy:deploy-file -DgroupId=my.group -DartifactId=artif-idbla -Dversion=0.9.2 -Durl=file:C:/Development/local-maven-repo -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=C:/path/my.jar

Then I connect it to the main project.

Main project pom.xml

<repositories>
    <repository>
        <id>local-maven-repo</id>
        <url>file://C:/Development/local-maven-repo</url>
    </repository>
</repositories>
<dependency>
        <groupId>my.group</groupId>
        <artifactId>artif-idbla</artifactId>
        <version>0.9.2</version>
</dependency>

It works!

Next, I make changes to my dependency, and I want to generate a new version of the project.I am changing the version from 0.92 to 0.9.21

External project pom.xml

<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<version>0.9.21</version>
<name></name>
<packaging>jar</packaging>

I reassemble the jar file and put it in the local repository.

-Dversion=0.9.21

Changing the main project pom.xml.

<dependency>
    <groupId>my.group</groupId>
    <artifactId>artif-idbla</artifactId>
    <version>0.9.21</version>
</dependency>

And I get an error.

Unresolved dependency: 'my.group:artif-idbla:jar:0.9.21'

This is what the local repository looks like. enter image description here

Here is the structure maven-metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<versioning>
    <release>0.9.21</release>
    <versions>
       <version>0.9.2</version>
       <version>0.9.21</version>
    </versions>
    <lastUpdated>20220707041151</lastUpdated>
</versioning>
</metadata>

For what reason does Maven not see version 0.9.21 but sees 0.9.2 ?

UPD 1. I use Intellij Idea.

When updating pom.xml the main project, I'm trying to update maven.

If version 0.9.2 is specified, everything works if 0.9.21 is not updated.

enter image description here

enter image description here

The only output I see in the console.

Unresolved dependency: 'my.group:artif-idbla:jar:0.9.21'
Santa Monica
  • 332
  • 3
  • 11

0 Answers0