Maven2无法从相对路径中找到父级 [英] Maven2 cannot find parent from relative path

查看:80
本文介绍了Maven2无法从相对路径中找到父级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Maven2,但是我的子项目找不到父项目.

I'm trying to use Maven2 but my child projects cannot find the parent project.

目录结构如下:

--parent
  --pom.xml
--child
  --pom.xml

子pom.xml文件如下:

Child pom.xml file looks like:

<parent>
    <groupId>com.mycompany.app</groupId>
    <artifactId>myapp</artifactId>
    <version>${app.version}</version>
    <relativePath>.../parent/pom.xml</relativePath>
</parent>

但是,当我使用Maven时,它甚至似乎都没有出现在相对路径中,而是试图从maven存储库中下载它.显然不在仓库中.我希望它查看相对路径.我究竟做错了什么?这是错误消息:

However when I use maven it doesn't even seem to look in the relative path, it seems to try and download it from the maven repository. It's obviously not in the repo. I want it to look at the relative path. What am I doing wrong? Here's the error message:

[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/mycompany/app/myapp/${app.version}/myapp-
${app.version}.pom
[INFO] Unable to find resource 'com.mycompany.app:myapp:pom:${app.version}' in reposit
ory central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: null:web:jar:null

Reason: Cannot find parent: com.mycompany.app:myapp for project: null:web:jar:null for
 project null:web:jar:null

推荐答案

您不能将属性用于父版本-它必须匹配.目前,此要求是以后可复制的.许多人正在对此问题进行跟踪 https://issues.apache.org/jira /browse/MNG-624

You can't use a property for the parent version - it must match. At the moment this is required for the build to be reproducible at a later date. A number of people are tracking this on issue https://issues.apache.org/jira/browse/MNG-624

这篇关于Maven2无法从相对路径中找到父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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