Search code examples
javamavenintellij-idea

IntelliJ - Module xx is imported From Maven. Any changes made in its configuration might be lost after reimporting mean?


IntelliJ displays these warning messages at Modules

enter image description here " Module xx is imported From Maven. Any changes made in its configuration might be lost after reimporting." (Note, this happens only when I press the Apply button on the Module)

I want to know what this means in detail and the solution...

For information Here:

<?xml version="1.0" encoding="UTF-8"?>

4.0.0

<groupId>me.codingtime</groupId>
<artifactId>NetworkPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>NetworkPlugin</name>

<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<repositories>
    <repository>
        <id>spigotmc-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
    <repository>
        <id>sonatype</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.17.1-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Solution

  • This error means that you must not modify the project structure and build configuration like project dependencies, compiler settings, sources/resources directories etc using IDE UI dialogs. Instead, you must do corresponding changes in the Maven pom.xml file.

    Because otherwise you will loose all such changes made in IDE UI after the project fill be Reloaded by the IDE from the maven build files (pom.xml).