将类添加到项目时奇怪的maven行为

时间:2018-03-13 07:27:32

标签: java eclipse maven

每当我在项目中创建或更改类名时,在尝试执行maven构建或安装时由于此错误而进行maven更新之前,我无法构建项目:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project app-webservice: Compilation failure: Compilation failure:
[ERROR] /C:/Development/app-webservice/src/main/java/test/app_webservice/controller/SoapRequestController.java:[19,51] package org.yaml.snakeyaml.external.biz.base64Coder does not exist
[ERROR] symbol:   variable Base64Coder
[ERROR] location: class test.app_webservice.controller.SoapRequestController
[ERROR] /C:/Development/app-webservice/src/main/java/test/app_webservice/controller/RestResponseController.java:[95,50] cannot find symbol
[ERROR] symbol:   variable Base64Coder

这是来自包org.yaml.snakeyaml.external.biz.base64Coder

这是一个非常恼人的纠结,我以前从未在maven项目中遇到过,有没有人知道它可能来自哪里?

我正在使用maven版本3.3.9和Eclipse IDE版本Luna Service Release 2(4.4.2)。

我的POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>test</groupId>
  <artifactId>app-webservice</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>app-webservice</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>


  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>wsdl4j</groupId>
      <artifactId>wsdl4j</artifactId>
    </dependency>
    <dependency>
      <groupId>com.jayway.jsonpath</groupId>
      <artifactId>json-path</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20171018</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope><!--$NO-MVN-MAN-VER$-->
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path-assert</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.20</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>spring-releases</id>
      <url>https://repo.spring.io/libs-release</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>spring-releases</id>
      <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
  </pluginRepositories>
</project>

1 个答案:

答案 0 :(得分:0)

org.yaml.snakeyaml.external.biz.base64Coder不存在意味着您没有在pom文件中指定的依赖关系或maven无法发现。