springBoot打包报错(Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile )

解决 Maven 编译错误:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0问题 通过上述方法,您可以解决由于 Maven 版本不兼容导致的编译错误。建议优先考虑升级 Maven 版本,这样不仅可以解决当前的问题,还可以享受新版 Maven 带来的其他好处。如果无法立即升级 Maven,可以选择降级 Spring Boot 版本或显式指定一个兼容的版本。希望这些信息对您有所帮助!如果您有其他问题,请随时提问。 阅读详情
AI摘要

本文介绍了如何在Spring Boot项目中使用多模块结构,并详细解释了如何解决子模块间依赖导致的编译错误及测试冲突问题。通过配置,实现项目的顺利打包与部署。

一:项目结构介绍
①:整体结构一个父pom,两个子pom
在这里插入图片描述
②:父pom

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.3.0.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.myrepository.mytemplate</groupId>
	<artifactId>spring-family-mytemplate</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>spring-family-mytemplate</name>
	<description>所有项目模块管理</description>
	<packaging>pom</packaging>

	<properties>
		<java.version>1.8</java.version>
	</properties>

    <modules>
        <module>spring-family-common</module>
		<module>spring-family-client</module>
    </modules>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>


③:family-common的pom

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.myrepository.mytemplate</groupId>
        <artifactId>spring-family-mytemplate</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <groupId>com.myrepository.mytemplate</groupId>
    <artifactId>spring-family-common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-family-common</name>
    <description>项目中公用模块</description>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


④:family-client的pom

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.myrepository.mytemplate</groupId>
        <artifactId>spring-family-mytemplate</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <groupId>com.myrepository.mytemplate</groupId>
    <artifactId>spring-family-client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-family-client</name>
    <description>Demo project for Spring Boot</description>
    <packaging>jar</packaging>


    <dependencies>
        <dependency>
            <groupId>com.myrepository.mytemplate</groupId>
            <artifactId>spring-family-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


二:出错截图和分析
1:family-common打包未报错,family-client打包报错,因为client依赖于common工程,找不到common工程下对应的包和类,报错截图:

D:\localfile\jdk-8u172-windows-i586\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\ideaWork\spring-family-mytemplate -Dmaven.home=D:\localfile\apache-maven-3.5.4 -Dclassworlds.conf=D:\localfile\apache-maven-3.5.4\bin\m2.conf "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=64266:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath D:\localfile\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version2019.1.3 -s D:\localfile\apache-maven-3.5.4\conf\settings.xml -Dmaven.repo.local=D:\localfile\apache-maven-3.5.4\repository package
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------< com.myrepository.mytemplate:spring-family-client >----------
[INFO] Building spring-family-client 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ spring-family-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-family-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\ideaWork\spring-family-mytemplate\spring-family-client\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[3,41] 程序包com.myrepository.mytemplate.enums不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[4,45] 程序包com.myrepository.mytemplate.exception不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[5,42] 程序包com.myrepository.mytemplate.result不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[22,12] 找不到符号
  符号:   类 PublicResult
  位置: 类 com.myrepository.mytemplate.controller.HelloController
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.861 s
[INFO] Finished at: 2020-06-28T15:30:44+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project spring-family-client: Compilation failure: Compilation failure: 
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[3,41] 程序包com.myrepository.mytemplate.enums不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[4,45] 程序包com.myrepository.mytemplate.exception不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[5,42] 程序包com.myrepository.mytemplate.result不存在
[ERROR] /D:/ideaWork/spring-family-mytemplate/spring-family-client/src/main/java/com/myrepository/mytemplate/controller/HelloController.java:[22,12] 找不到符号
[ERROR]   符号:   类 PublicResult
[ERROR]   位置: 类 com.myrepository.mytemplate.controller.HelloController
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1


三:解决方式
①:在被依赖的工程pom中加上(configuration代表的意思是打包为可执行jar包)

<configuration>
              <classifier>exec</classifier>
</configuration>

也就是在family-common工程中改为

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <classifier>exec</classifier>
                </configuration>
            </plugin>
        </plugins>
    </build>

②:再打包,继续报错

D:\localfile\jdk-8u172-windows-i586\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\ideaWork\spring-family-mytemplate -Dmaven.home=D:\localfile\apache-maven-3.5.4 -Dclassworlds.conf=D:\localfile\apache-maven-3.5.4\bin\m2.conf "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=65078:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath D:\localfile\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version2019.1.3 -s D:\localfile\apache-maven-3.5.4\conf\settings.xml -Dmaven.repo.local=D:\localfile\apache-maven-3.5.4\repository install
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------< com.myrepository.mytemplate:spring-family-client >----------
[INFO] Building spring-family-client 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ spring-family-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-family-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ spring-family-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ideaWork\spring-family-mytemplate\spring-family-client\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spring-family-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ spring-family-client ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.myrepository.mytemplate.SpringFamilyClientApplicationTests
15:40:39.384 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
15:40:39.399 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
15:40:39.430 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
15:40:39.447 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests], using SpringBootContextLoader
15:40:39.451 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTests-context.xml] does not exist
15:40:39.452 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTestsContext.groovy] does not exist
15:40:39.452 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
15:40:39.453 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: SpringFamilyClientApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
15:40:39.505 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]
15:40:39.583 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\ideaWork\spring-family-mytemplate\spring-family-client\target\classes\com\myrepository\mytemplate\SpringFamilyClientApplication.class]
15:40:39.584 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: URL [jar:file:/D:/localfile/apache-maven-3.5.4/repository/com/myrepository/mytemplate/spring-family-common/0.0.1-SNAPSHOT/spring-family-common-0.0.1-SNAPSHOT.jar!/com/myrepository/mytemplate/SpringFamilyCommonApplication.class]
15:40:39.587 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
15:40:39.587 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
15:40:39.588 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
15:40:39.588 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests], using SpringBootContextLoader
15:40:39.590 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTests-context.xml] does not exist
15:40:39.590 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTestsContext.groovy] does not exist
15:40:39.590 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
15:40:39.591 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: SpringFamilyClientApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
15:40:39.592 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]
15:40:39.596 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\ideaWork\spring-family-mytemplate\spring-family-client\target\classes\com\myrepository\mytemplate\SpringFamilyClientApplication.class]
15:40:39.597 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: URL [jar:file:/D:/localfile/apache-maven-3.5.4/repository/com/myrepository/mytemplate/spring-family-common/0.0.1-SNAPSHOT/spring-family-common-0.0.1-SNAPSHOT.jar!/com/myrepository/mytemplate/SpringFamilyCommonApplication.class]
15:40:39.597 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
15:40:39.597 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
15:40:39.597 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
15:40:39.598 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests], using SpringBootContextLoader
15:40:39.598 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTests-context.xml] does not exist
15:40:39.598 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: class path resource [com/myrepository/mytemplate/SpringFamilyClientApplicationTestsContext.groovy] does not exist
15:40:39.599 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
15:40:39.599 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]: SpringFamilyClientApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
15:40:39.602 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.myrepository.mytemplate.SpringFamilyClientApplicationTests]
15:40:39.605 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\ideaWork\spring-family-mytemplate\spring-family-client\target\classes\com\myrepository\mytemplate\SpringFamilyClientApplication.class]
15:40:39.606 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: URL [jar:file:/D:/localfile/apache-maven-3.5.4/repository/com/myrepository/mytemplate/spring-family-common/0.0.1-SNAPSHOT/spring-family-common-0.0.1-SNAPSHOT.jar!/com/myrepository/mytemplate/SpringFamilyCommonApplication.class]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.301 s <<< FAILURE! - in com.myrepository.mytemplate.SpringFamilyClientApplicationTests
[ERROR] com.myrepository.mytemplate.SpringFamilyClientApplicationTests  Time elapsed: 0.3 s  <<< ERROR!
java.lang.IllegalStateException: Found multiple @SpringBootConfiguration annotated classes [Generic bean: class [com.myrepository.mytemplate.SpringFamilyClientApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [D:\ideaWork\spring-family-mytemplate\spring-family-client\target\classes\com\myrepository\mytemplate\SpringFamilyClientApplication.class], Generic bean: class [com.myrepository.mytemplate.SpringFamilyCommonApplication]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in URL [jar:file:/D:/localfile/apache-maven-3.5.4/repository/com/myrepository/mytemplate/spring-family-common/0.0.1-SNAPSHOT/spring-family-common-0.0.1-SNAPSHOT.jar!/com/myrepository/mytemplate/SpringFamilyCommonApplication.class]]

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   SpringFamilyClientApplicationTests » IllegalState Found multiple @SpringBootCo...
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.331 s
[INFO] Finished at: 2020-06-28T15:40:40+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project spring-family-client: There are test failures.
[ERROR] 
[ERROR] Please refer to D:\ideaWork\spring-family-mytemplate\spring-family-client\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1


③:解决方式:
在对应的子模块中加上

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
            <skipTests>true</skipTests>
        </configuration>
 </plugin>

最终的结果就是family-common和family-client中都有如下代码:

 <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <classifier>exec</classifier>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>

四:完美解决

D:\localfile\jdk-8u172-windows-i586\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\ideaWork\spring-family-mytemplate -Dmaven.home=D:\localfile\apache-maven-3.5.4 -Dclassworlds.conf=D:\localfile\apache-maven-3.5.4\bin\m2.conf "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\lib\idea_rt.jar=49844:D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.3\bin" -Dfile.encoding=UTF-8 -classpath D:\localfile\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version2019.1.3 -s D:\localfile\apache-maven-3.5.4\conf\settings.xml -Dmaven.repo.local=D:\localfile\apache-maven-3.5.4\repository install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] spring-family-mytemplate                                           [pom]
[INFO] spring-family-common                                               [jar]
[INFO] spring-family-client                                               [jar]
[INFO] 
[INFO] --------< com.myrepository.mytemplate:spring-family-mytemplate >--------
[INFO] Building spring-family-mytemplate 0.0.1-SNAPSHOT                   [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.3.0.RELEASE:repackage (repackage) @ spring-family-mytemplate ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ spring-family-mytemplate ---
[INFO] Installing D:\ideaWork\spring-family-mytemplate\pom.xml to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-mytemplate\0.0.1-SNAPSHOT\spring-family-mytemplate-0.0.1-SNAPSHOT.pom
[INFO] 
[INFO] ----------< com.myrepository.mytemplate:spring-family-common >----------
[INFO] Building spring-family-common 0.0.1-SNAPSHOT                       [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ spring-family-common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-family-common ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ spring-family-common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ideaWork\spring-family-mytemplate\spring-family-common\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spring-family-common ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ spring-family-common ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ spring-family-common ---
[INFO] Building jar: D:\ideaWork\spring-family-mytemplate\spring-family-common\target\spring-family-common-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.3.0.RELEASE:repackage (repackage) @ spring-family-common ---
[INFO] Attaching repackaged archive D:\ideaWork\spring-family-mytemplate\spring-family-common\target\spring-family-common-0.0.1-SNAPSHOT-exec.jar with classifier exec
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ spring-family-common ---
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-common\target\spring-family-common-0.0.1-SNAPSHOT.jar to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-common\0.0.1-SNAPSHOT\spring-family-common-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-common\pom.xml to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-common\0.0.1-SNAPSHOT\spring-family-common-0.0.1-SNAPSHOT.pom
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-common\target\spring-family-common-0.0.1-SNAPSHOT-exec.jar to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-common\0.0.1-SNAPSHOT\spring-family-common-0.0.1-SNAPSHOT-exec.jar
[INFO] 
[INFO] ----------< com.myrepository.mytemplate:spring-family-client >----------
[INFO] Building spring-family-client 0.0.1-SNAPSHOT                       [3/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ spring-family-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ spring-family-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ spring-family-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ideaWork\spring-family-mytemplate\spring-family-client\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ spring-family-client ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ spring-family-client ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ spring-family-client ---
[INFO] Building jar: D:\ideaWork\spring-family-mytemplate\spring-family-client\target\spring-family-client-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.3.0.RELEASE:repackage (repackage) @ spring-family-client ---
[INFO] Attaching repackaged archive D:\ideaWork\spring-family-mytemplate\spring-family-client\target\spring-family-client-0.0.1-SNAPSHOT-exec.jar with classifier exec
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ spring-family-client ---
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-client\target\spring-family-client-0.0.1-SNAPSHOT.jar to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-client\0.0.1-SNAPSHOT\spring-family-client-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-client\pom.xml to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-client\0.0.1-SNAPSHOT\spring-family-client-0.0.1-SNAPSHOT.pom
[INFO] Installing D:\ideaWork\spring-family-mytemplate\spring-family-client\target\spring-family-client-0.0.1-SNAPSHOT-exec.jar to D:\localfile\apache-maven-3.5.4\repository\com\myrepository\mytemplate\spring-family-client\0.0.1-SNAPSHOT\spring-family-client-0.0.1-SNAPSHOT-exec.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] spring-family-mytemplate 0.0.1-SNAPSHOT ............ SUCCESS [  1.340 s]
[INFO] spring-family-common ............................... SUCCESS [  1.351 s]
[INFO] spring-family-client 0.0.1-SNAPSHOT ................ SUCCESS [  0.396 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.490 s
[INFO] Finished at: 2020-06-28T15:54:57+08:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0


Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile 一、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project community: Fatal error compiling解决方案 1、maven项目点击compile报出下面的错误 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:co 阅读详情

相关推荐

【异常】Maven提示错误Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

第一个可能报错的地方:父工程的pom.xml文件。(重要),需查看使用的jdk版本,这里我使用的是maven-compiler-plugin插件设置jdk的版本,这里修改为1.8(其他版本的jdk修改类似)首先,我创建的是一个springboot项目,一个父工程中包含多个子过程,相关的依赖版本都在父工程中进行了定义。所以,第一个需要查看的地方就是父工程的pom文件。版权声明:本文为CSDN博主「gao_jun1」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

奶爸的编程之路,也就一周冷个三天 7447

Maven依赖编译失败报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

报错笔记:IDEA2021无法执行compile编译Maven依赖 当我们对一个从github或其他人手里等其来源得到的Maven项目,进行执行compile编译pom.xml文件依赖时,经常出现Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project XXX: Fatal error compiling 的报错信息。 这种情况下,错误一般来

weixin_57107764的博客 3万+

R语言实战:非正态数据下的Scheirer–Ray–Hare检验全流程解析

本文详细解析了在R语言中执行Scheirer–Ray–Hare检验的全流程。当数据不满足正态分布假设时,该非参数检验是传统双因素方差分析的有效替代方案。文章从原理、R环境配置、数据准备、代码实现、结果解读到事后比较与可视化,提供了完整的实战指南,帮助研究者稳健地分析多因素实验设计中的主效应和交互效应。

cc789的博客 413

解决Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile

mvn clean package -Dmaven.test.skip=true 今天项目用maven命令打包时候抛出错误: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project springbootdemo: Fata...

分享传递价值 66万+

论文解读--Phase Noise in FMCW Radar Systems

相位噪声是现代雷达、通信、光谱和计量系统的基本性能参数之一。本文提出了一种适用于FMCW雷达系统的相位噪声理论。导出了一个新的设计方程,用于确定雷达系统中允许的源相位噪声电平的最大界。分析了在传输延迟小于参考振荡器相干时间时,相干混频引起的非线性相位噪声去相关函数;讨论了在传输延迟大于参考振荡器相干时间时,目标响应的频谱展宽。提出了收发链中各子系统的影响,并讨论了一种新的ADC相位噪声模型。介绍了相位噪声建模技术,然后将锁相环频率合成器与低噪声频率合成器进行比较,以演示减少相位噪声边带以改善检测和跟踪性能。

奔袭的算法工程师 3772

干货满满!AI应用架构师分享AI驱动虚拟展示干货

虚拟展示(Virtual Presentation):用数字技术将物理对象/场景转化为可交互的虚拟内容(比如3D文物、虚拟试衣间);AI驱动(AI-Powered):通过AI技术实现实时交互、智能决策、个性化生成,让虚拟内容“活”起来;AI驱动虚拟展示:以用户体验为核心,将“3D渲染+AI理解+实时数据”融合,形成“感知-决策-反馈”的闭环系统。前端交互层是用户直接体验到的部分,再厉害的AI和渲染,只要前端交互烂,用户都会跑。我见过很多团队为了“炫技”做了复杂的AI功能,结果用户不会用。

AI大模型应用之禅 542

SpringBoot打包报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

m0_62595472的博客 391

详细指南:如何在TI C2000基于C28x的微控制器上部署FreeRTOS_C语言实现

FreeRTOS是一个小型、开源、实时的嵌入式操作系统内核。它为多种微控制器和处理器提供了支持,包括ARM、AVR、MSP430和PIC等。小型和轻量级:适合资源受限的嵌入式系统。实时性:可以满足严格的实时要求。多任务支持:支持多任务并发执行。内存管理:提供了多种内存管理策略。模块化设计:用户可以根据需要选择所需的功能模块。TI C2000系列微控制器是专为实时控制应用设计的。高性能C28x核:提供了高速的浮点运算能力。丰富的外设:包括PWM、ADC、DAC、通信接口等。低功耗。

qq_38334677的博客 1609

idea报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co

一、错误描述 在使用maven工具进行项目打包时,报出了下面的错误: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 3.1:compile (default-compile) on project cloud-api-commons: Fatal error compiling 二、解决办法 我的jdk是1.8,下面以jdk1.8进行讲解 首先,我创建的是一个springboot项目,一个父工程中包含.

gao_jun1的博客 16万+

京东运维面试题及参考答案

cgroup(Control Group)是 Linux 内核提供的一种可以限制、控制与分离一个进程组群的资源(如 CPU、内存、磁盘 I/O 等)的机制。通过 cgroup,可以为不同的进程或进程组分配特定的资源配额,实现资源的隔离和管理。比如,在一个服务器上运行多个容器时,可以使用 cgroup 来限制每个容器对 CPU 和内存的使用,防止某个容器占用过多资源而影响其他容器的运行。cgroup 还可以对进程进行优先级设置,确保关键进程能够优先获得资源。

大模型大数据攻城狮的专栏 1248

Python控制程控电源(USB)

随着智能电动汽车行业的持续发展,汽车电子或嵌入式设备在软硬件的测试中,都会使用程控电源供电,特别是自动化测试、压力测试场景必定使用到程控电源控制,控制电源上下电,监听电源电流、电压等,以下就以常见的艾德克斯程控电源为例,分享如何通过USB连接方式Python语言来控制程控电源。

测试领域技术分享 2876

Maven报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile

有人又开始报其他的maven错误,归根结底还是你一开始springboot版本是3.x,你在创建项目时勾选的依赖也是按照这个3.x版本来的,此时你只是修改springboot版本,其他依赖版本没有修改到2.x的版本(所以我才比较推荐方法1),当然这个问题也可以解决。jdk1.8与springboot 3.X版本不兼容(一开始我以为是Maven的问题,为此还构造了maven项目,但是Maven项目却能成功,后来发现是Springboot版本问题)你写上2.会有提示,但是你会发现选取任意一个,还是会爆红报错。

weixin_50530351的博客 1万+

基于fme和python-docx第三方库批量更新不动产调查表

最近应朋友需要批量更新在不动产成果中提交的各种word报表中的指定数据,根据初步的了解,我做了一个基于fme软件和python-docx第三方库进行一个批量的更新方案。

weixin_43229258的博客 1244

idea报错:Failed to execute goal org.apache.maven.pluginsmaven-compiler-plugin3.1compile (default

首先,我创建的是一个springboot项目,一个父工程中包含多个子过程,相关的依赖版本都在父工程中进行了定义。所以,第一个需要查看的地方就是父工程的pom文件。,显示成功,所以最重要的就是jdk版本要对应起来,避免踩坑。我的jdk是1.8,下面以jdk1.8进行讲解。,需查看使用的jdk版本,这里我使用的是。插件设置jdk的版本,这里修改为。(其他版本的jdk修改类似)修改完成之后重新进行。...

a18721415176的博客 4524

C#上位机3D可视化:HelixToolkit.Wpf集成点云/模型(机器人臂姿态实时监控)

核心控件是3D可视化的核心,需搭配和网格辅助定位;模型加载:按关节拆分机械臂模型,通过组合平移+旋转实现姿态控制;姿态更新:将机器人关节角度转换为3D模型的旋转变换,工业场景需从控制器实时获取角度;点云渲染:通过实现点云加载,需注意坐标系转换和性能优化。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 720

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

SpringBoot:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile

Fatal error compiling: 无效的标记: --release -> [Help 1]

m0_65254915的博客 2725

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compi

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project kafak-demo: Fatal error compiling: 无效的标记: --release -> [Help 1]maven3.6.3不支持3.1.1springboot。springboot版本3.1.1。版本改为2.5.9 进行刷新编译。

weixin_42152736的博客 3412

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

idea报错:[ERROR] Failed to execute goal org.apache.maven.plugins_maven-compiler-plugin_3.11.0_compile

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project helloworld: Fatal error compiling: 无效的标记: --release ->maven-compliler-plugin版本与maven版本不一致,Maven版本太低或maven-compiler-plugin版本过高。

你若盛开,清风自来。 7291

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile

SpringBoot 升级到 3.0,需要 JDK17 做支撑,SpringBoot 3.0 搭配 JDK1.8 将无法启动项目,报版本不匹配错误。

Frame_X的博客 4267

解决springboot项目打包出错:Failed to execute goal org.apache.maven.pluginsmaven-compiler-plugin

解决:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile on project 项目名称 Fatal error compiling。

m0_67393827的博客 613

idea编译maven项目报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project mybatisplus: Fatal error compiling: 无效的标记: --release -> [Help 1]项目中maven-plugin版本不匹配。我的IDEA版本2023.2.3,JDK版本为1.8.我是把自己的maven版本降低到3.5.1,编译通过。

weixin_46081952的博客 6058

maven install时报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile

今天博主想把SpringBoot+maven的项目通过eclipse自带的maven插件进行打jar包,结果发现控制台报这个错误:     Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile经过网上搜索发现很多解决办法对于我的这个项目都不实用,经过半天的实验,终于解决了这个bug现在...

弗兰-随风小欢的博客 4万+

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)

出现 maven-compiler-plugin:3.1 错误,网上说的可能是jdk版本问题,其实,也有可能是spring-boot-maven-plugin版本问题,我用的是jdk8,如果用maven-plugin1.5.8版本,也不行,需要把maven-plugin版本改为更高的,如2.4.4版本,即可 (遇到一个问题,可能有多个方面原因造成,有多种解决方案,这里只是一种可能) ...

qq_36911595的博客 663

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compil

使用IDEA创建并运行springboot demo的时候报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project springboot_demo01: Fatal error compiling。④SpringBoot的版本:使用了3.1.5,一点运行不了,换成了 2.3.12.RELEASE 版本的就正常运行了。

weixin_45965919的博客 2740
上一篇: Stream将List转为Map汇总
下一篇: springboot整合使用Apollo配置中心
cxyrfg
博客等级 码龄9年 5粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值