我有一個像下面的父pom。問題與Maven屬性
<?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>com.parent.pom</groupId>
<artifactId>parent-pom</artifactId>
<version>1.0.0</version>
<name>parentpom</name>
<packaging>pom</packaging>
<properties>
<parentversion>1.0.0</parentversion>
</properties>
</project>
而我的孩子pom就像。
<?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>
<parent>
<groupId>com.parent.pom</groupId>
<artifactId>parent-pom</artifactId>
<version>${parentversion}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.child.pom</groupId>
<artifactId>child-pom</artifactId>
<version>2.0.0</version>
<name>Childpom</name>
<packaging>pom</packaging>
</project>
我的文件夾結構是這樣
POM測試(有根文件夾父POM) ---孩子(有孩子POM)
,當我跑MVN清潔在我的孩子安裝我得到如下的異常。
ERROR] The build could not read 1 project -> [Help 1]
ERROR]
ERROR] The project com.child.pom:child-pom:2.0.0 (C:\Users\kk\Desktop\POM-Test\child\pom.xml) has 1 error
ERROR] Non-resolvable parent POM: Could not transfer artifact com.parent.pom:parent-pom:pom:${parentversion} from/to central (http://repo.maven.apache.org/
maven2): Illegal character in path at index 63: http://repo.maven.apache.org/maven2/com/parent/pom/parent-pom/${parentversion}/parent-pom-${parentversion}.pom
and 'parent.relativePath' points at wrong local POM @ line 5, column 9 -> [Help 2
爲什麼我無法安裝此pom?
使用堆棧跟蹤發佈完整的錯誤消息。發佈您運行的Maven命令。也張貼您的目錄結構。 – Tunaki
這應該工作代碼明智的,也許你的文件夾結構或文件命名根本是不正確的? – user1438038