当前位置: 首页 > news >正文

广州网站建设好做吗谷歌搜索排名规则

广州网站建设好做吗,谷歌搜索排名规则,生猪价格今日猪价查询,本地门户网站系统我执行 mvn install 报如下错误 可是我在 web 模块中能正确引用到 common 的类,于是我把 web 引用到的 common 中的类先移动到 web 模块中,然后把 common 模块的类都删掉,然后再次执行 mvn install,结果报错如下: [ERROR] Faile…

我执行 mvn install 报如下错误
在这里插入图片描述
可是我在 web 模块中能正确引用到 common 的类,于是我把 web 引用到的 common 中的类先移动到 web 模块中,然后把 common 模块的类都删掉,然后再次执行 mvn install,结果报错如下:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.1.12:repackage (repackage) on project common: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.1.12:repackage failed: Unable to find main class -> [Help 1]
[ERROR]

这个问题的原因:
Spring Boot 的 spring-boot-maven-plugin 插件的 repackage 目标需要在构建时指定一个主类(main class),用于创建可执行的 JAR 或 WAR 文件。如果你的 common 模块不是一个 Web 或 Spring Boot 应用,它应该不需要这个插件的 repackage 目标,因为它并没有主类(main class)可供启动。

我的项目结构

父模块 - tylerpro

tylerpro 的 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 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>3.1.12</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.tylerpro</groupId><artifactId>tylerpro</artifactId><version>0.0.1</version><name>tylerpro</name><description>tylerpro</description><packaging>pom</packaging><modules><module>web</module><module>common</module></modules><properties></properties><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build>
</project>

子模块 - common

<?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><parent><groupId>com.tylerpro</groupId><artifactId>tylerpro</artifactId><version>0.0.1</version></parent><groupId>com.tylerpro</groupId><artifactId>common</artifactId><version>0.0.1</version><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>
</project>

子模块 - web

<?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.tylerpro</groupId><artifactId>tylerpro</artifactId><version>0.0.1</version></parent><groupId>com.tylerpro</groupId><artifactId>web</artifactId><name>web</name><description>web</description><properties></properties><dependencies><dependency><groupId>com.yxai</groupId><artifactId>common</artifactId><version>0.0.1</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build>
</project>

原因是 因为 common 模块中继承了父模块的打包插件,而 common 模块只是作为一个普通的库使用,它不是一个 springboot 项目。在父模块中使用了 spring-boot-maven-plugin 打包,所以 common 打包出错了。

解决方案

因为 web 中已经使用了 spring-boot-maven-plugin 打包插件,所以直接删除父模块中的打包插件就行。

<?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>3.1.12</version><relativePath/> <!-- lookup parent from repository --></parent><groupId>com.tylerpro</groupId><artifactId>tylerpro</artifactId><version>0.0.1</version><name>tylerpro</name><description>tylerpro</description><packaging>pom</packaging><modules><module>web</module><module>common</module></modules><properties></properties>

扩展:

maven 打包的几种方式:

SpringBoot 使用 maven 创建一个可执行的 jar 包 - SpringBoot官方文档-Creating an Executable Jar

apache maven plugin 打包插件
apache maven plugin 打包插件的属性配置

maven 高级视频教程

http://www.zhongyajixie.com/news/25631.html

相关文章:

  • 制作网站教学项目网站
  • 所有做运动的网站如何网站关键词优化
  • 精通网站建设 100seo怎么读
  • 做一些网站的弹出页面百度网页版链接
  • 几何图形生成网站软件注册推广平台
  • 免费模板网站下载国际军事新闻
  • 苏州设置网站建设怎么申请网站空间
  • 山东圣大建设集团网站引流推广怎么做
  • 手机数据线东莞网站建设地推的方法和技巧
  • 怎么做类似淘宝的网站链接平台
  • 如何选择网站模板哪个平台可以免费推广
  • 宁波外贸公司招聘关键词优化推广排名多少钱
  • 做高效能的父母网站搜索引擎优化人员优化
  • 怎么样子做网站近一周新闻热点事件
  • 政府网站平台安全建设方案网络推广培训课程内容
  • 长沙建网站企业谷歌地球
  • 厂房网关键词优化排名怎么做
  • 广州沙河一起做网站的网址百度seo排名规则
  • 住房和城乡建设部网站证书查询免费投放广告的平台
  • 日本漫画网站模板东莞seo优化推广
  • 网站二次开发费用2345网址导航删除办法
  • 网站url改版乐天seo视频教程
  • 2015做微网站多少钱下载百度搜索
  • 商业网站建设的方法企业查询
  • 沈阳哪家公司做的网站靠谱保健品的营销及推广方案
  • 静态网站用什么做个人博客网站搭建
  • 在vs上用c 做登录网站网上营销新观察网
  • 荣成市有做网站的吗网络广告案例
  • 兼职做网站 深圳关键字广告
  • 做个网站找别人做的吗网络推广网站程序