使用 maven-war-plugin 构建我的项目时,我收到以下错误,即使我在插件配置中指定它使用 jdk 7。
strings in switch are not supported in -source 1.5
Run Code Online (Sandbox Code Playgroud)
插件配置
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
Run Code Online (Sandbox Code Playgroud)
Maven WAR 插件没有源/目标配置。您必须配置maven-compiler-plugin。对此有两种可能的解决方案。
<project>
[...]
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
[...]
</project>
Run Code Online (Sandbox Code Playgroud)
另一个是这样的:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
944 次 |
| 最近记录: |