Module 'xxx' is imported from Maven. Any changes made in its configuration may be lost after reimporting

Viewed 345

⭐I have met the following problem several times, and dealt with it over and over...

enter image description here

⭐Until today, I found out where the problem is, but can't solve it~

Module 'xxx' is imported from Maven. Any changes made in its configuration may be lost after reimporting

enter image description here

⭐As the picture shows, once I reimport All Maven projects, its version will change to 13 from 8...

enter image description here

⭐After reimporting, it comes back:

enter image description here

I would appreciate it very grateful if you can assist me..

1 Answers

add the following codes in the pom.xml of your project:

<build>
    <plugins>
        <!-- ensure jdk 1.8-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

configure both <source> and <target> to 1.8(it's up to you).

reason: you have never set the jdk version. so every time you modify the pom.xml and reimport the dependencies, it will revert to the default JDK 13.

Related