Ada*_*dam 5 yaml maven maven-enforcer-plugin
我的 Maven POM 是 YAML(感谢io.takari.polyglot),并且我很难在 YAML 中编写配置,因为示例具有值,但我相信我应该将 的maven-enforcer-plugin规则配置banTransitiveDependencies为不采用includes或excludes。
到目前为止,这是我的尝试:
modelVersion: 4.0.0
artifactId: my-app
groupId: com.adam.stuff
version: 3.3.1
packaging: jar
properties:
spring.boot.version: 1.5.10.RELEASE
spring.core.version: 4.3.14.RELEASE
dependencies:
- artifactId: spring-boot-dependencies
groupId: org.springframework.boot
version: ${spring.boot.version}
type: pom
- artifactId: spring-boot-starter-web
groupId: org.springframework.boot
version: ${spring.boot.version}
- artifactId: spring-boot-starter-test
groupId: org.springframework.boot
version: ${spring.boot.version}
- artifactId: spring-context
groupId: org.springframework
version: ${spring.core.version}
- artifactId: spring-web
groupId: org.springframework
version: ${spring.core.version}
build:
plugins:
- artifactId: maven-enforcer-plugin
groupId: org.apache.maven.plugins
version: 3.0.0-M1
executions:
- id: enforce-ban-transitive-deps
goals: [enforce]
configuration:
rules:
banTransitiveDependencies:
comment: "Don't be a dummy"
- artifactId: spring-boot-maven-plugin
groupId: org.springframework.boot
version: ${spring.boot.version}
executions:
- goals: [repackage]
configuration:
fork: true
executable: true
Run Code Online (Sandbox Code Playgroud)
但插件抱怨:
[错误] 无法在项目 my-app 上执行目标 org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce (enforce-ban-transitive-deps):无法解析 mojo org 的配置.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:强制执行参数规则:无法创建接口org.apache.maven.enforcer.rule.api.EnforcerRule的实例:org.apache.maven.enforcer .rule.api.EnforcerRule.() -> [帮助 1]
这是文档: https: //maven.apache.org/enforcer/enforcer-rules/banTransitiveDependency.html
遵循该示例将包含和排除一些内容,而我此时不想这样做 - 因为一旦我弄清楚了配置,我想将其设置为可以使用!
我还尝试将他们的 XML 通过https://www.site24x7.com/tools/xml-to-yaml.html但它仍然给出相同的错误。
如果您想尝试,pom.yml请创建一个名为的目录和文件.mvn/extensions.xml,并将其放入项目的根目录中(在 旁边pom.xml),然后执行以下操作:
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-yaml</artifactId>
<version>0.2.1</version>
</extension>
</extensions>
Run Code Online (Sandbox Code Playgroud)
根据规则禁止传递依赖\'文档它是:
\n\n banTransitiveDependencies:\n message: ...\nRun Code Online (Sandbox Code Playgroud)\n\n而不是:
\n\n banTransitiveDependencies:\n comment: ...\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n该规则支持以下参数:
\n\n\xe2\x80\xa2 ...
\n
\n \xe2\x80\xa2 ...
\n \xe2\x80\xa2 消息 - 如果规则失败,则向用户发送的可选消息。将替换生成的报告消息。
| 归档时间: |
|
| 查看次数: |
9452 次 |
| 最近记录: |