当存储库中存在.jar时,为什么Maven正在寻找.pom文件? [英] Why Maven is looking for .pom file when .jar is present in the repository?

查看:82
本文介绍了当存储库中存在.jar时,为什么Maven正在寻找.pom文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的pom.xml中具有以下依赖项

I have the following dependency in my pom.xml

<dependency>
    <groupId>aGroup</groupId>
    <artifactId>anArtifact</artifactId>
    <version>aVersion</version>
</dependency>

我在~/.m2/repository/aGroup/anArtifact/aVersion目录中也有anArtifact-aVersion.jar文件.

当我开始构建项目时,maven查找.pom文件而不是使用.jar文件,并尝试下载以下文件

When I start building the project, maven looks for a .pom file instead of using the .jar file and attempts to download the following

http://repo1.maven.org/maven2/aGroup/anArtifact/aVersion/anArtifact-aVersion.pom

如何配置Maven以使用现有的.jar文件?

How can I configure maven to use the existing .jar file?

推荐答案

每个jar都需要有一个描述它的pom文件,您可以仅添加以下简单内容:

Every jar needs to have a pom file describing it, you can just add something simple like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>aGroup</groupId>
    <artifactId>aArtifactId</artifactId>
    <version>aVersion</version>
    <packaging>jar</packaging>
    <name>a Name</name>
</project>

这篇关于当存储库中存在.jar时,为什么Maven正在寻找.pom文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆