Maven打包后包名字母异常大写致Spring应用启动报错求助
Maven构建后包名小写字母被意外大写,导致Spring应用启动类找不到
首次发帖,如有不符合规范之处敬请谅解。
我正在开发Spring框架应用,加载org.cascade包下的组件。项目包含核心应用cascade-core,另有多个Maven模块放置在应用的lib文件夹中做功能扩展,例如cascade-distribution.0.0.1.jar、cascade-img.0.0.1.jar等。
原本一切正常,直到我扩展cascade-img.0.0.1.jar,添加了更多与Phasor绘图相关的类后,应用启动时出现报错,提示某些类无法读取,原因是类不存在。查看mvn clean package的生成结果后发现,文件确实存在,但包名中的字母被大写了——原本应为org.cascade.phasor.paramater.PhasorDataParamater.class,而生成的jar中却是org.cascade.Phasor.paramater.PhasorDataParamater.class,phasor的首字母p被意外大写。
程序在IDE(Eclipse)中运行正常,且在Eclipse中查看类文件结构时,phasor的p并未被大写,因此我认为问题与Maven构建有关,但未找到相关解释。
以下是我的POM文件:
<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.cascade</groupId> <artifactId>cascade-pom</artifactId> <version>0.0.1</version> </parent> <artifactId>cascade-img</artifactId> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.cascade</groupId> <artifactId>cascade-core</artifactId> <version>0.0.1</version> </dependency> <dependency> <groupId>ome</groupId> <artifactId>formats-gpl</artifactId> </dependency> <dependency> <groupId>ome</groupId> <artifactId>formats-api</artifactId> </dependency> <dependency> <groupId>ome</groupId> <artifactId>formats-bsd</artifactId> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2</artifactId> </dependency> <dependency> <groupId>io.scif</groupId> <artifactId>scifio</artifactId> </dependency> <dependency> <groupId>org.controlsfx</groupId> <artifactId>controlsfx</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math3</artifactId> </dependency> <dependency> <groupId>ai.djl</groupId> <artifactId>api</artifactId> </dependency> <dependency> <groupId>de.jensd</groupId> <artifactId>fontawesomefx-materialdesignfont</artifactId> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-swing</artifactId> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-ij</artifactId> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-algorithm</artifactId> <version>0.12.1</version> </dependency> <dependency> <groupId>net.imagej</groupId> <artifactId>imagej-ops</artifactId> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-roi</artifactId> <version>0.8.0</version> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-realtransform</artifactId> <version>3.1.2</version> </dependency> <dependency> <groupId>io.scif</groupId> <artifactId>scifio-bf-compat</artifactId> </dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-cache</artifactId> </dependency> <dependency> <groupId>org.kordamp.ikonli</groupId> <artifactId>ikonli-materialdesign2-pack</artifactId> </dependency> <dependency> <groupId>ome</groupId> <artifactId>jxrlib-all</artifactId> </dependency> <dependency> <groupId>org.jogamp.jogl</groupId> <artifactId>jogl-all-main</artifactId> </dependency> <dependency> <groupId>net.imagej</groupId> <artifactId>imagej</artifactId> <version>2.13.1</version> </dependency> </dependencies> </project>
我曾尝试过以下操作,但问题仍未解决:
- 查找可能导致包路径中单个字母大写的Maven属性,未找到相关解释
- 删除Phasor相关文件夹并重建
- 清理项目以及执行“Maven/更新项目...”操作
内容的提问来源于stack exchange,提问作者Michael Carnell
相关产品推荐
相关产品推荐

