建立专案时发生错误

时间:2018-10-14 13:00:44

标签: spring maven maven-compiler-plugin

我在Spring Framework上有一个项目

运行mvn clean install -DskipTests时出现错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project postcodeapp: Compilation failure
[ERROR] An unknown compilation problem occurred
[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

这是我的mvn和Java版本:

C:\Users\KazPost\Desktop\citypostkz\back-end>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11- 
10T22:41:47+06:00)
Maven home: C:\maven\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_131\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

C:\Users\KazPost\Desktop\citypostkz\back-end>javac -version
javac 1.8.0_131

C:\Users\KazPost\Desktop\citypostkz\back-end>java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

pom.xml中的maven-compiler-plugin

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>testCompile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

这是完整的pom.xml和stackTrace:https://gist.github.com/Abdubek/741b4e543b2f376cb2bff42dba447a89

当我启动mvn clean install时,将创建目标文件夹并发生错误,然后在本地启动时发生错误

Error: java: java.lang.AssertionError
Error: java: at com.sun.tools.javac.util.Assert.error(Assert.java:126)

如果我删除目标文件夹并再次在本地启动它,则启动成功。但是启动mvn后,干净安装不会再次开始。

2 个答案:

答案 0 :(得分:0)

尝试从依赖项中删除尽可能多的<version>标记。 Spring Boot具有几乎所有流行软件包的托管版本。让它管理版本。

(注释掉所有版本,并仅回退那些出现maven错误的版本)

...

如果仍然无法运行,请召唤驱魔人。这pom很大!

答案 1 :(得分:0)

我删除了这个文件夹,该文件夹在wsimport的过程中出现并获得了

com \ microsoft \ schemas_2003_10 \ serialization \ ObjectFactory.java

在搜索过程中,我在控制台中注意到了

/C:/Users/KazPost/Desktop/citypostkz/back-end/src/main/java/com/microsoft/schemas/_2003/_10/serialization/ObjectFactory.java:[29,8]重复类:com .microsoft.schemas._2003._10.serialization.ObjectFactory