Ways to ask Claude to debug
1) Asking for verification - do not use a generic prompt.
I'm working on a project to upgrade a liferay project from 7.2 to 7.4. Whenever I encounter an error, I would usually form a hypothesis in my mind, and ask Claude to verify if it's true or not. For example, I am having an issue with a library declared in build.gradle not being found in one of the module. The library being used in 7.2 was:
compileOnly group: "javax.portlet", name: "portlet-api"
compileOnly group: "javax.servlet", name: "javax.servlet-api"
But in 7.4, Claude recommended me to replace javax with jakarta.
compileOnly group: "jakarta.portlet", name: "portlet-api"
compileOnly group: "jakarta.servlet", name: "jakarta.servlet-api"
Upon building, I get an error:
> Could not find jakarta.portlet:portlet-api:.
Required by:
project :modules:thebank-cam-module:thebank-cam-services
> Could not find jakarta.servlet:jakarta.servlet-api:.
Finding it weird, I went ahead to the project settings.gradle file, and find out the source of the library, which is in
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
I checked the repository, and the library - compileOnly group: "jakarta.servlet", name: "jakarta.servlet-api", does exist.
Normally, I would just feed the error message to Claude, have it identify the root cause of the issue, and suggest a solution. And guess what's Claude solution, removing the library out of build.gradle
Therefore, I tried changing the way to ask Claude, for example,
<verify>the library is getting from "https://repository-cdn.liferay.com/nexus/content/groups/public" defined in settings.gradle, and the library exists in the repository.</verify><instructions>identify the source of the library <verify>jakarta.servlet", name: "jakarta.servlet-api is an existing library, and there is no other library that replaces that.</verify>, and identify the root cause of why Could not find jakarta.servlet:jakarta.servlet-ap as shown in the deploy log</instructions>
Comments
Post a Comment