gpt4 book ai didi

maven-pmd-plugin 禁用一个模块

转载 作者:行者123 更新时间:2023-12-01 10:45:39 26 4
gpt4 key购买 nike

我正在尝试为 maven 项目模块之一禁用 maven-pmd-plugin 的执行,但找不到有效的解决方案。
现在我在模块中有下一个:

    <properties>
<cpd.skip>true</cpd.skip>
<pmd.skip>true</pmd.skip>
<maven.pmd.enable>false</maven.pmd.enable>
<maven.pmd.cpd.enable>false</maven.pmd.cpd.enable>
</properties>

并在调试输出中有下一个:
[INFO] --- maven-pmd-plugin:3.2:cpd (pmd-cpd) @ module ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-pmd-plugin:3.2:cpd from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-pmd-plugin:3.2, parent: sun.misc.Launcher$AppClassLoader@6e70c242]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-pmd-plugin:3.2:cpd' with basic configurator -->
[DEBUG] (f) aggregate = false
[DEBUG] (f) compileSourceRoots = [/cicd/module/src/main/java]
[DEBUG] (f) format = xml
[DEBUG] (f) ignoreIdentifiers = false
[DEBUG] (f) ignoreLiterals = false
[DEBUG] (f) includeTests = false
[DEBUG] (f) includeXmlInSite = false
[DEBUG] (f) linkXRef = true
[DEBUG] (f) minimumTokens = 100
[DEBUG] (f) outputDirectory = /cicd/module/target/site
[DEBUG] (f) skip = true
[DEBUG] (f) skipEmptyReport = true
[DEBUG] (f) targetDirectory = /cicd/module/target
[DEBUG] (f) testSourceRoots = [/cicd/module/src/test/java]
[DEBUG] (f) xrefLocation = /cicd/module/target/site/xref
[DEBUG] (f) xrefTestLocation = /cicd/module/target/site/xref-test
[DEBUG] -- end configuration --
[DEBUG] Exclusions: **/*~,**/#*#,**/.#*,**/%*%,**/._*,**/CVS,**/CVS/**,**/.cvsignore,**/RCS,**/RCS/**,**/SCCS,**/SCCS/**,**/vssver.scc,**/project.pj,**/.svn,**/.svn/**,**/.arch-ids,**/.arch-ids/**,**/.bzr,**/.bzr/**,**/.MySCMServerInfo,**/.DS_Store,**/.metadata,**/.metadata/**,**/.hg,**/.hg/**,**/.git,**/.gitignore,**/.gitattributes,**/.git/**,**/BitKeeper,**/BitKeeper/**,**/ChangeSet,**/ChangeSet/**,**/_darcs,**/_darcs/**,**/.darcsrepo,**/.darcsrepo/**,**/-darcs-backup*,**/.darcs-temp-mail
[DEBUG] Inclusions: **/*.java
[DEBUG] Searching for files in directory /cicd/module/src/main/java
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[DEBUG] Executing CPD...

我想知道如果skip=true为什么会执行
据官方 FAQ我需要“简单地将 maven.pmd.enable=false 放入该子项目的项目属性中。”可能我没有正确地将它放入 pom.xml 中。它只是模块 pom 文件中的 吗?
-Dpmd.skip=true -Dcpd.skip=true 给出相同的结果

最佳答案

如果你想禁用一个 Maven 模块,你已经在那个模块中配置了 pmd。然后全部排除。
像这样:

			<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<analysisCache>true</analysisCache>
<!-- enable incremental analysis -->
<excludes>
<exclude>**/**</exclude>
</excludes>
</configuration>
</plugin>


Maven 多模块文档 ;hier
描述,子模块中的配置会覆盖顶级 pom 定义。

关于maven-pmd-plugin 禁用一个模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26546617/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com