Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)

Error message:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project space-search: Compilation failure
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project space-search: Compilation failure
[ERROR] /C:/Users/Administrator/Desktop/eclipse export file/test/space-search/src/main/java/com/space/search/dao/impl/SearchDaoImpl.java:[41,53] -source The diamond operator is not supported in 1.5
[ERROR] (please use -source 7 or higher to enable diamond operator)
[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

wrong reason:

There are many reasons, but mine should be caused by the problem of that version

Solution: as shown below



Add in the pom.xml file. . . mine, this will fix it

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325832493&siteId=291194637