Solve the problem that target code version of Maven project sub module in IntelliJ idea is always rolled back

Recently, I encountered the problem that the target code version of Maven sub module in IntelliJ idea has been rolled back. On the first day, in the idea setting, set the target code version of all sub modules to 1.8, and on the second day, roll back to 1.5, 1.6 and other versions.

The way to search online is to add the following plug-in information to Maven’s POM file:

<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<version>3.6.0</version>
		<configuration>
		    <encoding>UTF-8</encoding>
		    <source>1.8</source>
		<target>1.8</target>
		</configuration>
</plugin>

We did, but the problem still recurred. After several struggles, we finally found the existence of the problem.

In my project, the design of each sub module pom.xml In the file, either the parent information is not specified, or the parent of its own sub module pom.xml The target version is defined by myself, so the modification added in the parent POM can’t affect the setting of the sub module. The problem still exists.

Now, after sorting out the parent-child relationship of each module, this problem never appears again.

Read More: