我有一個Pom.xml我想知道是否有一種方法讓Pom從某處下載父POM,然後引用父POM。有一個Pom.xml下載並引用一個父Pom
編輯:我在與父POM的問題,這是父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>
<groupId>dev</groupId>
<artifactId>company-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<distributionManagement>
<repository>
<id>Artifactory</id>
<name>Artifactory-releases</name>
<url>http://artifactory:8081/artifactory/dev</url>
</repository>
<snapshotRepository>
<id>Artifactory</id>
<name>Artifactory-snapshots</name>
<url>http://artifactory:8081/artifactory/dev</url>
</snapshotRepository>
</distributionManagement>
</project>
我已經上傳了父母的pom.xml到artifactory的,這裏是我的pom.xml。
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>maven.Test</groupId>
<artifactId>Hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Artifactory</name>
<url>http://artifactory:8081/artifactory/webapp/home.html?0</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<parent>
<groupId>dev</groupId>
<artifactId>company-parent</artifactId>
<version>1.0.0</version>
</parent>
</project>
但是當我運行它,我得到這個錯誤
[ERROR] Non-resolvable parent POM for maven.Test:Hello:1.0-SNAPSHOT: Could n
ot find artifact dev:company-parent:pom:1.0.0 in central (https://repo.maven.a
pache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 22,
column 9 -> [Help 2]
如何我有我的雙響炮找到自己artifactory的實例中的神器?
這是有點不清楚你的意思。父POM會自動下載並安裝在本地存儲庫中。 – Daniel
啊好吧,讓我試着更好地解釋這一點,我想讓Parent Pom託管在某處,就像在Artifactory上一樣。然後我想讓我的電腦上的Pom.xml運行一個命令來下載父Pom並引用它。這有幫助嗎? – Macauley
可能的重複[從遠程存儲庫下載父pom](http://stackoverflow.com/questions/12566835/download-parent-pom-from-remote-repository) –