我使用intellij2020.3.2,maven版本3.6.3,java版本15.0.2。
我有一个名为sdsd3的父项目和名为Module_Project的子项目。
我无法打包子项目,这里分别是父子项目的错误信息。
[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]
个字符
下面是我的pom.xml父项目:
<?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>
型
和子项目的pom.xml
<?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>
型
为什么父项目可以编译,而子项目不能编译?怎么修?
这里是我的intellij maven设置
1条答案
按热度按时间8yoxcaq71#
版本3.6.3中没有编译器插件。最新版本是3.8.1。
编译器插件的版本与Maven本身的版本无关。
父项目没有使用编译插件,所以问题出现在构建子项目时。