Compilation Error on maven

2.3k views Asked by At

Working on maven project. I m trying to build using maven but I m getting the following error! I m working on eclipse using JDK 8.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

I also tried the above solution, but still I m getting error!

[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building RESTfulWebServiceExample 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ RESTfulWebServiceExample ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Tomcat 7.0\webapps\RESTfulWebServiceExample\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RESTfulWebServiceExample ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\Tomcat 7.0\webapps\RESTfulWebServiceExample\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[4,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[5,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[6,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[7,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[8,24] package javax.ws.rs.core does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[10,2] cannot find symbol
  symbol: class Path
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[18,40] cannot find symbol
  symbol:   class PathParam
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[15,7] cannot find symbol
  symbol:   class GET
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[16,7] cannot find symbol
  symbol:   class Path
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[17,8] cannot find symbol
  symbol:   class Produces
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[33,40] cannot find symbol
  symbol:   class PathParam
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[30,8] cannot find symbol
  symbol:   class Path
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[31,8] cannot find symbol
  symbol:   class GET
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[32,8] cannot find symbol
  symbol:   class Produces
  location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[INFO] 14 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.041 s
[INFO] Finished at: 2015-06-15T11:33:01+05:30
[INFO] Final Memory: 12M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project RESTfulWebServiceExample: Compilation failure: Compilation failure:
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[4,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[5,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[6,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[7,19] package javax.ws.rs does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[8,24] package javax.ws.rs.core does not exist
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[10,2] cannot find symbol
[ERROR] symbol: class Path
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[18,40] cannot find symbol
[ERROR] symbol:   class PathParam
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[15,7] cannot find symbol
[ERROR] symbol:   class GET
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[16,7] cannot find symbol
[ERROR] symbol:   class Path
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[17,8] cannot find symbol
[ERROR] symbol:   class Produces
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[33,40] cannot find symbol
[ERROR] symbol:   class PathParam
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[30,8] cannot find symbol
[ERROR] symbol:   class Path
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[31,8] cannot find symbol
[ERROR] symbol:   class GET
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] /D:/Tomcat 7.0/webapps/RESTfulWebServiceExample/src/org/test/webservices/FeetToInchAndInchToFeetConversionService.java:[32,8] cannot find symbol
[ERROR] symbol:   class Produces
[ERROR] location: class org.test.webservices.FeetToInchAndInchToFeetConversionService
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
2

There are 2 answers

3
Anilkumar Bathula On BEST ANSWER

Check with that below dependency is it present or not ??

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m01</version>
</dependency>
0
Olaf Kock On

You seem to be missing the dependency on javax.ws.rs. Make sure that you have this in your pom.xml and try again.

Whatever tutorial you're following should have quite a bit of information about these dependencies as well.