如何在maven中停止下载被禁止的依赖项
我已在 pom.xml 中添加了禁止的依赖项。虽然它成功检测到被禁止的依赖项,但它仍在下载被禁止的依赖项。
如何取消下载被禁止的依赖项。 这是我的代码。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>enforce-maven</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>org.apache.logging.log4j:log4j-core:(,2.17.0)</exclude>
</excludes>
<includes>
<!--Allowed-->
</includes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
I have added the banned dependency in the pom.xml. Though it successfully detect the banned dependencies but it's still downloading the banned dependencies.
How can I cancel the download of the banned dependencies.
Here's my code.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>enforce-maven</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>org.apache.logging.log4j:log4j-core:(,2.17.0)</exclude>
</excludes>
<includes>
<!--Allowed-->
</includes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
执行器插件(与任何其他插件一样)在下载发生后运行。
因此,enforcer 插件无法阻止下载的发生。
The enforcer plugin (like any other plugin) runs after the downloads have happened.
Therefore, the enforcer plugin cannot stop the download from happening.