Search code examples
javaxmlmavenintellij-idea

child maven project cannot find maven-compiler-plugin


I use intellij2020.3.2, maven version 3.6.3, java version 15.0.2.
I has a parent project named sdsd3, and child project named Module_Project.
I cannot package the child project, here is the error message of parent and child project, respectively.

[INFO] SDSD3 Project ...................................... SUCCESS [  0.004 s]
[INFO] SDSD3 Project - Module ............................. FAILURE [  0.075 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.6.3 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-compiler-plugin:jar:3.6.3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR] 
[WARNING] The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:3.6.3 is missing, no dependency information available
The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:3.6.3 is missing, no dependency information available

Here is my pom.xml of parent project:

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

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>aa.com.dennis</groupId>
  <artifactId>sdsd3</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>


  <name>SDSD3 Project</name>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <build.stage>local</build.stage>
    <org.slf4j.version>1.7.21</org.slf4j.version>
    <org.projectlombok.version>1.16.10</org.projectlombok.version>
    <org.springframework.version>4.3.3.RELEASE</org.springframework.version>
    <org.apache.tiles.version>3.0.7</org.apache.tiles.version>
    <junit.version>4.12</junit.version>
    <mybatis.version>3.4.1</mybatis.version>
    <mybatis-spring.version>1.3.0</mybatis-spring.version>
    <jstl.version>1.2</jstl.version>
    <javax.servlet-api.version>4.0.0-b01</javax.servlet-api.version>
  </properties>
  <modules>

    <module>Module_Project</module>
  </modules>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.6.3</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

and pom.xml of child project

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>sdsd3</artifactId>
        <groupId>tw.com.gss</groupId>
        <version>1.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>war</packaging>
    <artifactId>Module_Project</artifactId>


    <name>SDSD3 Project - Module</name>

<!--    <properties>-->
<!--        <maven.compiler.source>15</maven.compiler.source>-->
<!--        <maven.compiler.target>15</maven.compiler.target>-->
<!--    </properties>-->
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>${mybatis.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>${mybatis-spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>${org.apache.tiles.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <version>${org.apache.tiles.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>${org.apache.tiles.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.10</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.0-b01</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>Module_Project</finalName>
        <resources>
            <resource>
                <directory>src/main/resources/${build.stage}</directory>
            </resource>
            <resource>
                <directory>src/main/resources/common</directory>
            </resource>
        </resources>
    </build>

</project>

Why parent project can compile, but child cannot? How to fix it? enter image description here here is my intellij maven setting


Solution

  • There is no compiler plugin in version 3.6.3. The recent version is 3.8.1.

    The version of the compiler plugin is not related to the version of Maven itself.

    The parent project does not use the compile plugin, so the problem appears when building the child.