mvn安装无法创建胖jar

时间:2016-08-19 12:13:55

标签: java spring maven

我试图将我的项目部署到胖罐中,但它失败了,我试图在mvn clean之前运行mvn install,一切看起来都不错,但错误仍然发生在我项目的所有类中。 这是错误(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文件中一切都很好!

1 个答案:

答案 0 :(得分:1)

我可能错了,但是不是错误消息说你的Customer类中缺少一个字符,我会在第41行,第35个字符(我假设该行的结尾,所以很可能是你'错过了一个“;”。)

您的IDE是否显示错误?