gdaramouskas
gdaramouskas

Reputation: 3747

Java Annotations simple error

I am newbie at Java EE and I have a simple problem. I created a project using Maven plugin's default directory structure and I want to annotate a class as @Loggable, but I get a

Loggable cannot be resolved to a type

error. Any annotation I want to use can't be resolved to a type. What's the problem? I suspect that it has to do with dependency or build path issues but I can seem to get it working.

Upvotes: 0

Views: 409

Answers (2)

Tactical Downvote
Tactical Downvote

Reputation: 2393

You will have a list of dependencies in the pom.xml file of your maven project. Make sure the jar that has Loggable is listed as a dependency.

Read here how to do it.

Your import java.lang.annotation.*; will not help as Loggable is not in that namespace.

Maybe you should write this Annotation on your own. Read this to learn more.

Upvotes: 1

You have to import annotation classes just like anything else. Use an IDE such as Eclipse; it will handle and many similar tasks for you automatically.

Upvotes: 0

Related Questions