compilation error, package javax.ws.rs does not exist, dependencies not resolved from maven

You need to include the Java EE dependencies in your POM, with a provided scope (aka, the files will eventually be provided by the application server, but in the meantime I need them for compilation).

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

I had this and more similar issues after system update, when NetBeans changed fonts, and GUI in general. I have resolved this issue by adding Java EE 6 API Library in NetBeans IDE by doing

myProject->Properties->Libraries->Add Library


I think this dependency is better

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>jsr311-api</artifactId>
    <version>1.1.1</version>
</dependency>

Tags:

Maven