为什么不看到依赖项的特定版本?
我有一个单独的项目,将其组装到JAR文件中,并作为我的主要项目的外部依赖性连接。
外部项目pom.xml
<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<version>0.9.2</version>
<name></name>
<packaging>jar</packaging>
将JAR文件放入本地存储库中的命令。
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
然后,我将其连接到主要项目。
主要项目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>
它有效!
接下来,我对依赖性进行更改,我想生成一个项目的新版本。我是从<<<<<<<强> 0.92至0.9.21
外部项目pom.xml
<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<version>0.9.21</version>
<name></name>
<packaging>jar</packaging>
我重新组装jar文件并将其放在本地存储库中。
-Dversion=0.9.21
更改主要项目pom.xml。
<dependency>
<groupId>my.group</groupId>
<artifactId>artif-idbla</artifactId>
<version>0.9.21</version>
</dependency>
,我会遇到错误。
未解决的依赖性:'my.group:artif-idbla:jar:0.9.21'
结构
<?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>
这是Maven-metadata.xml 的 Maven的原因没有看到0.9.21版本,而是看到0.9.2?
upd 1。 我使用Intellij Idea。
更新pom.xml主项目时,我正在尝试更新Maven。
如果指定了0.9.2版,则如果未更新0.9.21,则一切都可以。
我在控制台中看到的唯一输出。
Unresolved dependency: 'my.group:artif-idbla:jar:0.9.21'
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.
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.
The only output I see in the console.
Unresolved dependency: 'my.group:artif-idbla:jar:0.9.21'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论