【发布时间】:2016-12-26 14:26:30
【问题描述】:
我试图将我的项目部署到一个胖 jar 中,但它失败了,我尝试在 mvn install 之前运行 mvn clean,一切看起来都很好,但错误仍然发生在所有类上我的项目。
这是错误(1类):
CMD
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile <default-compile> on project application: Compilation failure: Compilation failure:
[ERROR] /C:/Workspace/MyProject/src/main/com/project/Customer.java [35, 41] cannot find symbol
pom.xml
<groupId>project</groupId>
<artifactId>application</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
<version>3.6.4.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
<finalName>executableJar</finalName>
</build>
关于如何解决这个问题的任何想法?
代码行
第 35 行 / ^ = 41
public int deleteUser (long id, Regi^on region) throws MyException;
回答
所以经过几个小时的搜索问题是 pom.xml 没有读取这些类所需的依赖项,我刚刚将依赖项添加到我的 pom.xml 文件中,一切正常!
【问题讨论】:
-
编译器错误将您定向到该行上的特定行和字符 - 最好在问题中添加该 sn-p。