当前位置: 首页 > 知识库问答 >
问题:

maven上的编译错误

宰父熙云
2023-03-14

从事maven项目。我试图使用maven进行构建,但我遇到了以下错误!我正在使用JDK 8开发eclipse。

无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:编译(默认编译

我也尝试了上面的解决方案,但我仍然得到错误!

[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个答案

任宾鸿
2023-03-14

您似乎缺少了对javax的依赖。ws。rs.确保你的pom中有这个。然后重试。

无论您遵循什么教程,都应该有关于这些依赖关系的大量信息。

罗安宁
2023-03-14

检查下面的依赖项是否存在??

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m01</version>
</dependency>
 类似资料:
  • 问题内容: 当我在Netbeans中构建并运行程序时,它可以正常工作。但是当我尝试“ mvn compile”时,使用相同的pom.xml文件会出现以下错误: 我的Java版本不是1.3,这里是“ mvn -version”的结果 这是第53行: 问题答案: 问题是在Maven2中默认使用和 您可以通过将其添加到pom中来解决此问题: 将其放在最顶层的父pom中是很实际的,这样您派生的pom不需要

  • 编译模块com。实例我的包裹。GWT。HelloGWT [INFO]验证新编译的单元 [INFO]在第一次过程中忽略了1个单元,其中包含编译错误 [INFO]编译时将-strict或-logLevel设置为TRACE或DEBUG以查看所有错误 [INFO]在文件:/home/ilsurih/Projects/maven hibernate/src/main/java/com/example/myP

  • 我在Eclipse中使用maven创建了一个webapp项目。当我在命令提示符下运行命令mvn包时,它会显示folowing错误。 我尝试更改jdk和JRE。但不起作用。仍然显示相同的错误

  • 生成失败,错误如下: [ERROR]未能执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:编译(默认编译)上的项目r esPonderhub:编译失败[ERROR] /X:/工作区/响应器HubWorkspace/响应器Hub/src/main/java/uk/org/响应器Hub/MemberServlet.java:[23,110]找

  • 问题内容: 我在(版本3.1)中使用。当我尝试编译下一行代码 使用maven-compiler-plugin(版本3.3),我收到编译失败消息: 我使用Java 1.7.0_55进行编译。 我该如何解决? 问题答案: 发生问题是因为方法的签名具有可变参数。调用方法时,将分三个阶段搜索所有适用的方法。在阶段3中搜索具有可变参数的方法,在该阶段中,可以进行装箱和拆箱。 因此和都适用于此处,因为考虑了装

  • 删除.m2文件夹 重新安装Eclipse 在pom.xml上设置可执行文件 将生成选项设置为清除 pom.xml 没有一个奏效。有什么猜测吗?