如何在dependency-lock-maven-plugin 1.0版本中忽略依赖
解决dependency-lock-maven-plugin 1.0版本忽略指定依赖的问题
在1.0版本中,插件已将旧版本的<ignore>配置替换为<ignoredDependencies>节点,你可以在插件的<configuration>块中添加该配置,精准忽略你的core模块依赖,避免SHA校验失败。
具体配置示例
在父模块的pom.xml中配置插件时,添加如下内容:
<plugin> <groupId>com.github.ferstl</groupId> <artifactId>dependency-lock-maven-plugin</artifactId> <version>1.0.0</version> <executions> <!-- 保留你的原有执行配置,比如lock、verify等 --> <execution> <id>lock-dependencies</id> <goals> <goal>lock</goal> </goals> </execution> <execution> <id>verify-dependencies</id> <goals> <goal>verify</goal> </goals> </execution> </executions> <configuration> <!-- 忽略core模块的依赖 --> <ignoredDependencies> <dependency> <groupId>你的项目groupId</groupId> <artifactId>core</artifactId> <version>0.0.1-SNAPSHOT</version> <!-- 可选:若需忽略特定范围,可添加<scope>test</scope>,默认忽略所有范围 --> </dependency> </ignoredDependencies> </configuration> </plugin>
关键说明
<ignoredDependencies>下的每个<dependency>节点需指定groupId和artifactId,版本可指定具体SNAPSHOT版本,也可省略(会匹配该artifactId的所有版本)。- 该配置会全局生效,覆盖所有子模块,避免
service或其他依赖core的模块触发SHA校验错误。 - 执行
mvn clean package时,插件会跳过对core-0.0.1-SNAPSHOT.jar的SHA与版本校验。
内容的提问来源于stack exchange,提问作者reiley
相关产品推荐
相关产品推荐

