微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

本地 .pom 文件未注册?

如何解决本地 .pom 文件未注册?

我正在尝试将项目从在线检索(成功)pom 文件转换为在本地查找,但由于执行“重新加载所有 Gradle 项目”,我收到此错误

A problem occurred configuring root project 'ImageConverter'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.test.gradle.plugins:test-gradle-plugins-common:2.0.1.
     Searched in the following locations:
       - file:/C:/Users/me/.m2/repository/com/test/gradle/plugins/test-gradle-plugins-common/2.0.1/test-gradle-plugins-common-2.0.1.pom
       - file:/C:/Users/me/.m2/repository/com/test/gradle/plugins/test-gradle-plugins-common/2.0.1/test-gradle-plugins-common-2.0.1.jar
     required by:
         project :

Possible solution:
 - Declare repository providing the artifact,see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

这是我在根 build.gradle 中的一个片段:

buildscript {
    repositories {
        mavenLocal() {
            MetadataSources {
                mavenPom()
                artifact()
            }
        }
    }

    dependencies {
        classpath 'com.test.gradle.plugins:test-gradle-plugins-common:2.0.1'
    }
}

和 .pom 文件(我从以前工作的在线版本逐字复制)开始是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test.gradle.plugins</groupId>
  <artifactId>test-gradle-plugins-common</artifactId>
  <version>2.0.1</version>

我可以从错误消息中复制 .pom 路径,ls 就可以了,因此该文件肯定存在。我做错了什么??

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。