“Unknown artifact. Not resolved or indexed” error for scalatest 手动添加依赖

本文描述了使用Sbt下载依赖后,在代码中无法使用import的问题,并提供了详细的解决方案,包括如何切换回ApacheIvy进行依赖项管理,以及手动配置已下载包的方法。

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

问题描述

使用sbt 下载了依赖后代码中不能使用 import 出问题,中间排查了很久决定记录一下。
在这里插入图片描述

解决 sbt 下载依赖后不能使用

sbt 1.3.0+使用Coursier实施依赖项管理。 在sbt 1.3.0之前,sbt使用Apache Ivy已经有十年了。 Coursier在保持兼容性方面做得很好,但是某些功能可能特定于Apache Ivy。 在这种情况下,您可以使用以下设置切换回ivy

ThisBuild / useCoursier := false

在这里插入图片描述

手动配置添加下载好的包
在这里插入图片描述
在这里插入图片描述
解决!!

参考
https://stackoverflow.com/questions/41372978/unknown-artifact-not-resolved-or-indexed-error-for-scalatest
https://www.cnblogs.com/zhaoxd07/p/7235852.html

Artifact deployment error in test1:war typically occurs when there's a problem while deploying a WAR (Web Application Archive) file to a server, such as Apache Tomcat or a similar web application container. This error usually indicates that the server is unable to complete the deployment process due to various reasons, which might include: 1. Invalid or missing dependencies: The WAR file may be dependent on other libraries that are not present in the server's classpath. 2. Configuration issues: Incorrect server configuration, like incorrect context path, servlet mapping, or security settings, can lead to deployment errors. 3. Class loading problems: If there's a conflict between classes or resource files within the WAR, it could cause issues. 4. Server resource limitations: Insufficient memory or disk space, or reaching max number of deployed applications, can prevent successful deployment. 5. Runtime exceptions: There could be a runtime issue in the application code that surfaces during deployment. To resolve this error, you should check the server logs for detailed information about the specific error, which will usually provide more context and steps to fix the issue. Here are some steps to troubleshoot: 1. **Review server logs**: Look for stack traces, error messages, or warnings that can guide you to the root cause. 2. **Check the deployment descriptor**: If you have a `web.xml` file in your WAR, verify that all configurations are correct. 3. **Maven dependencies**: Ensure that all necessary libraries are included and have compatible versions. 4. **Clean and redeploy**: Try cleaning the server's work directory or undeploying the problematic application before redeploying. 5. **Run tests locally**: If possible, deploy the application locally using a development server to isolate the issue from the production environment.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值