The POM for 0.0.1-SNAPSHOT is missing, no dependency informat

本文介绍了在Maven项目中遇到的一个测试问题及其解决过程。主要包括:调整测试文件名以匹配类名;对依赖项目执行clean和testinstall操作;最后重新进行cleantest操作解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

解决方法:

       1、首先,更改了test文件的名字,保持它与类的名字相同

        2、对其依赖的maven项目进行clean和test install操作

        3、重新对自己设置的这个maven项目进行clean test操作,最后问题就解决了

PS D:\Java\mpdemos> mvn dependency:tree -Dincludes=com.baomidou [INFO] Scanning for projects... [INFO] [INFO] ------------------------< org.example:mpdemos >------------------------- [INFO] Building mpdemos 0.0.1-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.700 s [INFO] Finished at: 2025-03-24T22:53:38+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Unknown lifecycle phase ".baomidou". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin -artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, g enerate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, tes t-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
03-25
[INFO] Scanning for projects... [INFO] [INFO] -------------< com.testingplaform:testing-plaform-backend >------------- [INFO] Building testing-plaform-backend 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The artifact mysql:mysql-connector-java:jar:8.0.31 has been relocated to com.mysql:mysql-connector-j:jar:8.0.31: MySQL Connector/J artifacts moved to reverse-DNS compliant Maven 2+ coordinates. [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ testing-plaform-backend --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ testing-plaform-backend --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 58 source files to f:\Testing Plaform\backend\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /f:/Testing Plaform/backend/src/main/java/com/testingplaform/service/AutomationTestServiceImpl.java:[51,113] 闇€瑕?)'鎴?,',' [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.247 s [INFO] Finished at: 2025-06-17T04:00:06+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project testing-plaform-backend: Compilation failure [ERROR] /f:/Testing Plaform/backend/src/main/java/com/testingplaform/service/AutomationTestServiceImpl.java:[51,113] 闇€瑕?)'鎴?,'[m [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException f:\Testing Plaform\backend>mvn clean install [INFO] Scanning for projects... [INFO] [INFO] -------------< com.testingplaform:testing-plaform-backend >------------- [INFO] Building testing-plaform-backend 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The artifact mysql:mysql-connector-java:jar:8.0.31 has been relocated to com.mysql:mysql-connector-j:jar:8.0.31: MySQL Connector/J artifacts moved to reverse-DNS compliant Maven 2+ coordinates. [INFO] [INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ testing-plaform-backend --- [INFO] [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ testing-plaform-backend --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ testing-plaform-backend --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 58 source files to f:\Testing Plaform\backend\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /f:/Testing Plaform/backend/src/main/java/com/testingplaform/service/AutomationTestServiceImpl.java:[51,113] 闇€瑕?)'鎴?,',' [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.377 s [INFO] Finished at: 2025-06-17T04:01:00+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project testing-plaform-backend: Compilation failure [ERROR] /f:/Testing Plaform/backend/src/main/java/com/testingplaform/service/AutomationTestServiceImpl.java:[51,113] 闇€瑕?)'鎴?,'[m [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException f:\Testing Plaform\backend> * 还原的历史记录 Microsoft Windows [版本 10.0.19045.4780] (c) Microsoft Corporation。保留所有权利。 F:\Testing Plaform>cd "f:\Testing Plaform\backend" f:\Testing Plaform\backend>mvn clear install [INFO] Scanning for projects... [INFO] [INFO] -------------< com.testingplaform:testing-plaform-backend >------------- [INFO] Building testing-plaform-backend 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.198 s [INFO] Finished at: 2025-06-17T04:01:52+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Unknown lifecycle phase "clear". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
最新发布
06-18
### 解决 Maven 依赖 `hd.msrv.common:msrv-common:jar:0.0.1-SNAPSHOT` 的 POM 文件丢失问题 当遇到 Maven 报错提示无法找到特定版本的 artifact 或其 POM 文件时,通常是因为本地仓库或远程仓库中确实不存在该资源。对于 `Could not find artifact hd.msrv.common:msrv-common:jar:0.0.1-SNAPSHOT` 这类错误消息,有几种常见解决方案可以尝试。 #### 验证并更新项目的配置文件 pom.xml 确保项目中的父级 POM 和子模块 POM 中定义的所有依赖项路径正确无误,并且 SNAPSHOT 版本号一致[^1]。如果存在多个模块,则需检查各模块间的相互引用关系是否准确设置。 #### 清理与重新构建本地缓存 有时由于网络连接不稳定或其他因素可能导致某些构件未能成功下载到本地存储库内。此时可以通过运行如下命令来清理已损坏的数据: ```shell mvn clean install -U ``` 参数 `-U` 表示强制更新快照版本(snapshots),这有助于获取最新的可用版本信息[^2]。 #### 检查远程仓库地址及权限 确认所使用的镜像源 URL 是否有效以及是否有足够的访问权限去读取所需的 artifacts 。如果是在企业内部环境中工作的话,可能还需要配置私有的 Nexus/Artifactory 等服务器作为中央仓库代理[^3]。 #### 使用完整的坐标声明方式指定依赖 在 `<dependency>` 节点下显式地给出 group ID, artifact ID 及 version 字段值而不是依靠继承自其他地方设定好的默认值。这样做的好处是可以减少因间接引入而导致找不到目标组件的风险。 ```xml <dependencies> <dependency> <groupId>hd.msrv.common</groupId> <artifactId>msrv-common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies> ``` 通过上述方法应该能够有效地处理大多数情况下关于 "missing artifact" 类型的问题。当然具体情况还需具体分析,比如查看日志输出寻找更多线索等。
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值