在IntelliJ+Maven的Java项目中引入dcm4che 5库遇问题求助
解决dcm4che-core 5.32.1 Maven依赖拉取失败问题
问题根源
你配置的https://maven.dcm4che.org/是dcm4che 2.x系列的专属仓库,仅存放旧版本依赖,5.x+版本已不再发布到该仓库,因此Maven无法找到5.32.1版本的构件描述符。
解决方案
不需要手动添加JAR包,调整Maven仓库配置即可正常拉取5.x版本:
更新仓库配置
dcm4che 5.x版本已同步到Maven中央仓库,你可以直接移除原有的dcm4che-repo仓库配置,Maven会自动从中央仓库拉取依赖。如果遇到中央仓库同步延迟,可添加Sonatype的OSS公共仓库作为补充:<repositories> <repository> <id>sonatype-oss-public</id> <url>https://oss.sonatype.org/content/repositories/public/</url> </repository> </repositories>清理并重新拉取依赖
执行以下命令清理本地Maven缓存并强制更新依赖:mvn clean install -U
修改后的完整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.3.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>org.example</groupId> <artifactId>migration</artifactId> <version>0.0.1-SNAPSHOT</version> <name>migration</name> <description>migration</description> <properties> <java.version>17</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-core</artifactId> <version>5.32.1</version> </dependency> </dependencies> <!-- 可选:若中央仓库未同步,添加Sonatype仓库 --> <repositories> <repository> <id>sonatype-oss-public</id> <url>https://oss.sonatype.org/content/repositories/public/</url> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
补充说明
dcm4che项目从5.x版本起调整了发布策略,将新版本推送至Maven中央仓库,旧的maven.dcm4che.org仅维护2.x版本,因此无需再配置该私有仓库。
内容的提问来源于stack exchange,提问作者Cory Merrick
相关产品推荐
相关产品推荐

