且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven 构建编译错误:无法在项目 Maven 上执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)

更新时间:2021-11-09 17:46:19

发生错误是因为代码不适用于那里使用的默认编译器.在声明依赖项之后,在根元素结束之前将此代码粘贴到有效 POM 中,以更改使用的编译器.根据需要调整版本.

The error occurred because the code is not for the default compiler used there. Paste this code in effective POM before the root element ends, after declaring dependencies, to change the compiler used. Adjust version as you need.

<dependencies>
...
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>