cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CAP CDS Import error in JAVA

Saurav
Product and Topic Expert
Product and Topic Expert
1,705

Hi Team,

I am getting "The import cds cannot be resolvedJava(268435846)" in my CAP JAVA project.

I updated the project from pom.xml file and also cleaned and reloaded the java server from command center but still facing the same issue.

Is there something I need to config to get rid of these?

Thanks for your Help

Cheers

Saurav

View Entire Topic
robinjayasinghe
Product and Topic Expert
Product and Topic Expert
0 Kudos

The build error you see indicates that the IDE cannot resolve the code that is being generated from the CDS sources of your project. Have you already performed a full Maven build of your project? You could do so by calling "mvn compile" on the commandline (the terminal view of your IDE). After that you can reload the Java server one more time.

Saurav
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Robin,

Thanks for your help.

I did that compilation and again reloaded the Java server but still facing same issue.

robinjayasinghe
Product and Topic Expert
Product and Topic Expert
0 Kudos

Normally, this should just work with VS Code. Have you checked if the class not being found is actually available in the srv/src/gen/java folder structure? If it is not you need to check your build configuration. If it is available your VS Code Java LSP does not recognize the additional source folder. You can add some Maven configuration in the srv/pom.xml file that helps IDEs to discover additional source folders. Please check this article for further details: https://www.baeldung.com/maven-add-src-directories

That's most probably all I can do for you on this channel. If the issue persists you can open a ticket on our internal channels (as you're an SAP employee).

SilasL
Explorer

Hey All,

I noticed that I had the same issue and I was working on an SAP Tutorial for CAP Java. I don't seem to be the only one either as someone as already created a post about it. An error occurs in steps 1-3 of CAP Tutorial 'Extend the bookstore with custom code' | SAP Community.

I get the following error in my handler file. Path is srv/src/main/java/com/sap/cap/bookstore/handlers/OrdersService.java

When I go into the Java file for this import. I get the following warning for the package name.

The path for the Java file is srv/src/gen/java/cds/gen/ordersservice/OrdersService_.java

It seems like the issue is the Java file isn't in the classpath for the project. How would I adjust the classpath when the project is in BAS, is this something I need to add to the pom.xml file?

Thanks,

Silas