Mnick
Mnick

Reputation: 333

Mule4 Cannot find custom java class

I'm using Anypoint Studio 7 and having an IDE problem using custom java class in src/main/java. I'm referencing it using java:invoke. The error is something like this.

Unable to find type 'com.sample.TestClass' on build path of project mule-sample.xml

Please take note that the application is running fine since I added the package in mule-artifact.json. That folder is also in the build path. It's just strange to see that error in the IDE. Any idea how to resolve this problem?

Edit: I updated the version of Anypoint Studio from 7.3.1 to 7.4.1. I also updated the version of Mule Maven Plugin as instructed by Aled. In doing so, there's no need to include classLoaderModelLoaderDescriptor attribute in mule-artifact.json. However, I'm still getting the IDE error that the custom java class that I created under src/main/java is not found. Though it still works fine when it is being run. It's just annoying to see the IDE error.

Upvotes: 2

Views: 1267

Answers (1)

aled
aled

Reputation: 25837

If you are using the last versions of Studio, the Mule Maven Plugin and the Java Module you should not need to change mule-artifact.json to export the package of the class. Also you should never change the build path in Studio 7.x. All the build path information should come from interpreting the pom.xml. Otherwise you will have differences in behavior between design and execution times.

Upvotes: 1

Related Questions