执行目标org.springframework.boot:spring-boot maven插件的默认cli:2.4.4



我是Springboot的新手,正在尝试重新创建我的教师应用程序,但在运行时出错

mvn清洁包装弹簧靴:重新包装

表示在后端模块中找不到主类。错误消息:

[信息]测验的根源。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。成功[0.386 s]

[信息]后端。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。故障[11.162s]

[信息]前端。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。已跳过【信息】--------------------------------------------------------------------------

[INFO]生成失败[信息]----------------------------------------------------------------

[错误]无法执行目标org.springframework.boot:spring-boot maven插件:2.4.4:在项目后端重新打包(默认cli(:执行目标org.spring框架的默认cli。boot:spring-boot maven-plugin:2.4.4:重新打包失败:找不到主类->[帮助1]

运行应用程序的@Springbootapplication主类位于前端模块中。我该如何告诉应用程序?我尝试了这些步骤,在根pom文件中添加了一个springboot-maven插件,但仍然没有成功。我还试图减少包的数量,并使application.class尽可能靠近src文件夹,尽管这些都不重要,因为它对我的老师有效。

这是我的根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 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>quiz</artifactId>
<groupId>org.quiz</groupId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Root of quiz</name>
<modules>
<module>backend</module>
<module>fronten</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<fs>${file.separator}</fs>
<version.java>11</version.java>
<version.jacoco>0.8.5</version.jacoco>
<!--  FIXME version 1.4.200 breaks tests, eg in JPA-JPQL  -->
<version.h2>1.4.197</version.h2>
<version.testcontainers>1.15.1</version.testcontainers>
<version.selenium>3.141.59</version.selenium>
<version.springboot>2.3.5.RELEASE</version.springboot>
<version.junit>5.7.0</version.junit>
<version.junit.platform>1.5.2</version.junit.platform>
<!--
TODO: cannot update to 4.3+ as conflicts of major versioning
of Groovy runtime
-->
<version.surefire-failsafe>3.0.0-M4</version.surefire-failsafe>
<version.hibernate.validator>6.1.0.Final</version.hibernate.validator>
<version.hibernate.core>5.3.7.Final</version.hibernate.core>
<version.javax.el>3.0.0</version.javax.el>
<version.javax.javae.api>8.0.1</version.javax.javae.api>
<jbossTarget>${basedir}/target/downloaded_Wildfly</jbossTarget>
<jbossHome>${jbossTarget}/wildfly</jbossHome>
<!--  When updating this version, must also update Dockerfile using jboss/wildfly 
images-->
<version.wildfly>18.0.1.Final</version.wildfly>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- SpringBoot BOM -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${version.springboot}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${version.springboot}</version>
<scope>test</scope>
<!-- Exclude JUnit 4, which is added by default-->
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Hibernate-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${version.hibernate.core}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${version.hibernate.validator}</version>
<scope>provided</scope>
</dependency>
<!-- Database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.4</version>
</dependency>
<!--Containers, all needed??-->
<dependency>
<!-- Note: this has the other as dependency -->
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId><!--Db-->
<version>${version.javax.el}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.core</groupId>
<artifactId>arquillian-core-api</artifactId>
<version>1.5.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>2.2.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.5.0.Final</version>
<!-- make sure it is in test scope -->
<scope>test</scope>
</dependency>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
<!--
This depends on Spring version, see:
https://github.com/joinfaces/joinfaces
However, SpringBoot 2.1 would require 4.x (eg 4.0.9) here,
but it does not work, whereas 3.2 is fine...
-->
<version>3.2.3</version>
</dependency>
<!--Selenium-->
<dependency>
<!-- used to control a browser for system testing -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${version.selenium}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- used to control a browser for system testing -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>${version.selenium}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- used to control a browser for system testing -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${version.selenium}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- used to control a browser for system testing -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>${version.selenium}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- used to control a browser for system testing -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${version.selenium}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- for code coverage -->
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.core</artifactId>
<version>${version.jacoco}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- To use Docker from tests -->
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${version.testcontainers}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- To support JUnit 5  -->
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.testcontainers}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>selenium</artifactId>
<version>${version.testcontainers}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>


<build>
<pluginManagement>
<plugins>
<plugin>
<!-- Need to create self-executable uber/fat jars for SpringBoot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${version.springboot}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Used to download and unpack JBoss/Wildfly automatically before running the 
tests-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${version.wildfly}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${jbossTarget}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- Built-in plugin used to compile Java code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<inherited>true</inherited>
<configuration>
<release>${version.java}</release>
</configuration>
</plugin>
<!-- For running ANT tasks, like renaming files/folders -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
</plugin>
<!--
When unzipping Wildfly, the folder name will contain the version.
This is not good, as then we would need to hardcode such version
in each Arquillian file.
So, we make sure to rename such folder.
Why? If then we change Wildfly version, we only update such value
here in the pom file, and not in every single Arquillian file...
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>Rename Wildfly folder</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<move file="${jbossTarget}/wildfly-${version.wildfly}"
tofile="${jbossTarget}/wildfly"
failonerror="false"
/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- this is needed to run integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.surefire-failsafe}</version>
<configuration>
<forkCount>1</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
<argLine>-Xms512m -Xmx4096m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Built-in plugin used to execute unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire-failsafe}</version>
<configuration>
<forkCount>1</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
<argLine>-Xms512m -Xmx2048m</argLine>
</configuration>
</plugin>

<!-- Avoid failing War generation if web.xml is missing, as we ll not
use it in some example modules -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!-- For cloud deployment on Heroku -->
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<!--code coverage-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${version.jacoco}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-prepare-agent-integration</id>
<phase>package</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>default-report-integration</id>
<phase>verify</phase>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

这是后端模块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 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>1.0-SNAPSHOT</version>
<parent>
<artifactId>quiz</artifactId>
<groupId>org.quiz</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>backend</artifactId>
<groupId>org.quiz.backend</groupId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<!--Springboot, versions are retrieved from springboot BOM (pom) in parent pom-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--Database-->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- For code coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<!-- Built-in plugin used to execute unit tests, (TODO: tests passes without this 
too) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<rerunFailingTestsCount>3</rerunFailingTestsCount>
<!--suppress UnresolvedMavenProperty -->
<argLine>${argLine} -Xms512m -Xmx4096m</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>

项目结构的图片(我不被允许在这里张贴图片(

这是我试图重新创建的存储库

我在这里遇到了类似的错误,我的代码找不到主类,我将此属性添加到pom.xml文件中:

<spring-boot.repackage.skip>true</spring-boot.repackage.skip>

这里的一切都很顺利。

我找到了使用命令的正确方法

mvn清洁包装弹簧靴:重新包装

导航到只包含主类的模块(在我的情况下是前端模块(,然后运行

mvn干净安装

在其他中

最新更新