`
Taylorshirley
  • 浏览: 10221 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

repackage failed: Unable to find main class

 
阅读更多

一.错误信息

SpringBoot进行Maven install操作时报repackage failed: Unable to find main class -> [Help 1]的错误,信息如下

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage (default) on project qfxSpringbootReadPropertiesDemo: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:repackage failed: Unable to find main class -> [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/PluginExecutionException

 

二.错误原因

因为没有正式环境的入口类,项目结构如下:

repackage failed: Unable to find main class

pom.xml文件的<build>配置信息如下:

repackage failed: Unable to find main class

 

三.解决方案1

pom.xml文件的<build>中指定入口类,代码如下

<configuration>

        <mainClass>com.qfx.App</mainClass>

</configuration>

如图

repackage failed: Unable to find main class

四.解决方案2

去掉<build>配置信息中spring热部署的配置,如图

repackage failed: Unable to find main class

 

五.解决方案3

修改pom.xml配置文件<build>内容如下,添加一个<pluginManagement>标签,代码如下

    <build>

        <finalName>test</finalName>

        <pluginManagement>

            <plugins>

                <plugin>

                    <groupId>org.springframework.boot</groupId>

                    <artifactId>spring-boot-maven-plugin</artifactId>

                    <dependencies>

                        <!-- spring热部署 -->

                        <dependency>

                            <groupId>org.springframework</groupId>

                            <artifactId>springloaded</artifactId>

                            <version>1.2.8.RELEASE</version>

                        </dependency>

                    </dependencies>

                </plugin>

            </plugins>

        </pluginManagement>

    </build>

 

六.再次执行 Maven install,一切正常(企业架构源码可以加求球:三五三六二四七二五九)

分享到:
评论

相关推荐

    maven出现:Failed to execute goal on project …: Could not resolve dependencies for project …

    在使用Maven构建Java项目时,可能会遇到这样一个错误:“Failed to execute goal on project …: Could not resolve dependencies for project …”。这个错误通常表明Maven在构建过程中遇到了依赖解析问题,无法...

    一键给apk资源文件添加资源混淆

    一键给apk资源文件添加资源混淆

    前端开源库-repackage

    "前端开源库-repackage"项目就是一个专注于优化和重新打包开源库的实践,目的是提升开发效率并确保跨平台兼容性。 首先,我们要理解什么是“repackage”。在软件工程中,"repackage"通常指的是将现有的软件包进行...

    pit1_spring boot之 maven install 报错[Maven]1

    然而,当出现错误 `[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.2.RELEASE:repackage (default) on project com.mutistic.boot` 时,这意味着Spring Boot的Maven插件在...

    cmexprt

    CMEXPRT订购Web服务 先决条件 Java 8 Maven的3.6.x ...mvn clean package spring-boot:repackage docker:build API文档 在项目运行期间,可以在http://host:port/api/v1/swagger-ui/上找到Web API文档。

    spring-boot-maven-plugin-中文参考文档-2.7.5

    - `mainClass`: 指定应用的主类,通常是包含`@SpringBootApplication`注解的类。 - `layout`: 打包布局,可以选择JAR或WAR。 - `classifier`: 添加到最终JAR或WAR文件的分类标识,用于区分不同构建版本。 - `...

    FOX LOGO 富士康主板LOGO更改

    上次的是945以下的板子,这个是支持H61之类,看下面支持的类型。 5. Supported OS and ... - Package: repackage. 2011/5/13 - 2.0.0.0 - FoxLogo.exe: Updated from 1.0.0.7 to 1.0.0.8, added support for Z68A02.

    IDEA 如何打war包

    - `&lt;mainClass&gt;`:指定主类,即程序入口。 - `&lt;executions&gt;`:执行列表,这里配置了一个`repackage`目标,用于重新打包项目。 - `maven-war-plugin`:用于打包成WAR文件的Maven插件。 - `&lt;failOnMissingWebXml&gt;...

    spring-boot-docs-1.5.18.RELEASE

    - `repackage`:重打包应用程序,以便可以直接运行jar或war文件。 - `start`和`stop`:启动和停止在本地运行的Spring Boot应用。 - `build-info`:生成包含构建信息的资源,如版本号、git提交等,这些信息可以在...

    命令行工具Opc-diag.zip

    diff a part between two Office DocumentsUse Case 4: extract a package to a directoryUse Case 5: repackage a package directory into a fileUse Case 6: substitute a part from one package into another ...

    SpringBoot开发环境、测试环境、部署环境切换.pdf

    &lt;mainClass&gt;com.auth.ucenter.UcenterUserApplication&lt;/mainClass&gt; &lt;goal&gt;repackage ``` 5. **执行Maven命令切换环境** 当需要打包不同环境的版本时,可以通过以下命令切换: - 打包开发环境...

    spring-boot-maven-plugin 插件的作用详解

    - 如果不继承自`spring-boot-starter-parent`,则可以在`&lt;build&gt;&lt;plugins&gt;`部分的`&lt;configuration&gt;`标签内直接配置`&lt;mainClass&gt;`,如:`&lt;mainClass&gt;com.xx.xx&lt;/mainClass&gt;`。 3. **重新打包(Repackage)** 插件...

    Spring Boot 2 Maven 模板

    - `repackage`:生成可执行的JAR或WAR文件,包含了嵌入式服务器。 - `build-info`:生成包含构建信息的资源文件,可用于展示应用的构建元数据。 ### 7. 使用模板 在提供的"templete"文件中,可能包含了一个基础的...

    springboot + jsp 打包教程

    -- Remove the following exclude if you want to use JSP --&gt; &lt;!-- &lt;groupId&gt;org.springframework.boot &lt;artifactId&gt;spring-boot-starter-tomcat &lt;/exclusions&gt; --&gt; ``` 接下来,我们需要配置`src/main/...

    EnvironmentSwitcher::fire:No repackage, switch environment with one click.(无需重新打包,一键切换环境 )

    环境切换器 Environment Switcher是在Android开发和测试过程中使用Java批注,APT,Reflection和Proguard原理在单击过程中切换环境的工具。 特征 易于配置 安全,不会泄漏测试环境的URL 一键切换环境,无需重新包装 ...

    springboot用maven打包1

    这里,`addClasspath`设置为`true`,表示在`MANIFEST.MF`中添加类路径,`classpathPrefix`指定了类路径前缀(这里是`lib/`),`mainClass`则指定了应用的入口点。 然而,仅仅这样配置还不足以处理项目中的外部依赖...

    SpringBoot之瘦身部署的详细步骤

    &lt;mainClass&gt;com.johnnian.App&lt;/mainClass&gt; &lt;layout&gt;ZIP &lt;goal&gt;repackage ``` 然后,进入项目根目录,执行以下命令: ``` mvn clean install ``` 将编译后的 Jar 包解压,拷贝 BOOT-INF ...

    piriform碎片整理大师

    - You may NOT repackage, translate, adapt, vary, modify, alter, create derivative works based upon, or integrate any other computer programs with, the Product in whole or in part. - You may NOT use ...

    一文解决springboot打包成jar文件无法正常运行的问题

    &lt;mainClass&gt;server.demo.DemoApplication&lt;/mainClass&gt; &lt;goal&gt;repackage ``` 2. 接下来,请不要使用 IntelliJ IDEA 来打包项目为 Jar 文件,而是使用 Maven 来打包。在项目的根目录下,使用...

    elasticsearch.zip

    &lt;mainClass&gt;com.example.Application&lt;/mainClass&gt; ${project.build.directory}/deployments &lt;goal&gt;repackage ``` 这段配置会将SpringBoot应用打包成可执行的JAR或WAR文件,便于部署。 在...

Global site tag (gtag.js) - Google Analytics