java - Maven - 不可解析的父 POM,找不到工件 SNAPSHOT
问题描述
我正在尝试构建一个 Maven 项目。我没有构建Java项目的经验,这是我的第一个maven项目。我尝试从终端和 IntelliJ 构建项目,运行时收到此错误mvn clean install
:
[FATAL] Non-resolvable parent POM for my.project.tk.at.batcher:batcher:${revision}:
Could not find artifact my.project.tk.at:parentpom:pom:5.20.0-SNAPSHOT and
'parent.relativePath' points at wrong local POM
这是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>
<parent>
<groupId>my.project.tk.at</groupId>
<artifactId>parentpom</artifactId>
<version>5.20.0-SNAPSHOT</version>
</parent>
<groupId>my.project.tk.at.batcher</groupId>
<artifactId>batcher</artifactId>
<name>batcher</name>
<packaging>pom</packaging>
<version>${revision}</version>
<scm>
<connection>scm:git:ssh://git@git.my.project.no/autfor/jobscheduler.git</connection>
<developerConnection>scm:git:ssh://git@git.my.project.no/autfor/jobscheduler.git</developerConnection>
<url>https://git.my.project.no/projects/AUTFOR/repos/jobscheduler</url>
</scm>
<properties>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.patch>0</version.patch>
<revision>${version.major}.${version.minor}.${version.patch}-SNAPSHOT</revision>
</properties>
<!-- Shared build properties -->
<modules>
<module>batcher-common</module>
<module>batcher-sql</module>
<module>scheduler</module>
<module>notifier-batch</module>
<module>notifier-examtime-batch</module>
<module>notifier-attest-batch</module>
<module>ssb-batch</module>
<module>alert-user-batch</module>
<module>delete-history-batch</module>
<module>alert-user-about-delivery-batch</module>
<module>batcher-main</module>
<module>delete-quarantine-batch</module>
</modules>
<distributionManagement>
<repository>
<id>svv-artrepo-release</id>
<name>svv-artrepo-release</name>
<url>https://artrepo.remote-project.no/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>svv-artrepo-snapshots</id>
<name>svv-artrepo-snapshots</name>
<url>https://artrepo.remote-project.no/artifactory/libs-snapshot-local</url>
</snapshotRepository>
<!-- <repository>-->
<!-- <id>nexus-release-repository</id>-->
<!-- <name>Nexus release repo</name>-->
<!-- <url>http://10.250.4.100:8081/nexus/content/repositories/releases</url>-->
<!-- </repository>-->
<!-- <snapshotRepository>-->
<!-- <id>nexus-snapshot-repository</id>-->
<!-- <url>http://10.250.4.100:8081/nexus/content/repositories/snapshots</url>-->
<!-- <layout>default</layout>-->
<!-- </snapshotRepository>-->
</distributionManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<!-- copy from common master, since ${project.build.directory} gets false value if it is not duplicated -->
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<propertyName>failsafeArgLine</propertyName>
<destFile>${project.build.directory}/jacoco.exec</destFile>
<append>true</append>
</configuration>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Exclude all generated sources -->
<excludes>
<exclude>**/wsgen/**/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>codecoverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>owasp</id>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven-project-info-reports-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${org.owasp.dependency-check-maven.version}</version>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>
</project>
我该如何解决这个错误?
解决方案
该错误表示my.project.tk.at:parentpom:pom:5.20.0-SNAPSHOT
找不到父 POM。
所以它不在您的本地存储库中(您没有在本地构建它并且您之前没有使用过它)并且它也不在您指定的任何远程存储库中(如果您在settings.xml
or中指定了任何pom.xml
)。
因此,要么将父 POM 更正为您真正要查找的 POM,要么查看为什么所需的父 POM 不在指定的存储库中。另请阅读 Stanislav Bashkyrtsev 的有用评论。
推荐阅读
- html - 如何使用角度创建动态表
- html - 如何停止覆盖 x-amz-website-redirect-location 元数据
- asp.net - 如何在我的 asp.net 页面中使用数据库设置源?
- javascript - 如何从 microsoft graph api 接收转换后的文件
- python - 获取自定义对象的属性无法按预期工作
- r - 更改图例点的颜色 (ggplot2)
- r - 在 R 中使用 formattable() 时,逗号后的数字不会出现
- hyperlink - 当我在 Github 上部署我的 Hugo 网站时,“项目”中的链接出错
- amazon-web-services - 为什么我不能使用 SAM 更新我的 Lambda LayerVersion?
- firebase - Firebase 实时数据库侦听器定价