由于错误,跳过 JQAssistant 对特定子模块项目的扫描和分析

Skip JQAssistant scan & analyze for a particular sub module project due to error

当一个父项目下有多个模块时,如何让jqassistant不扫描或分析某个模块?这是因为我在执行 jqassistant:scan、使用父 pom.xml 分析时出现以下错误。但是当 运行 单独时,扫描和分析是成功的。不确定失败的原因。那么有没有办法从 jqassistant 扫描和分析中跳过这个模块?

Maven 错误

[ERROR] Failed to execute goal com.buschmais.jqassistant:jqassistant->maven-plugin:1.3.0:analyze (default-cli) on project >myXYZProjectIntegrationTests: Execution default-cli of goal >com.buschmais.jqassistant:jqassistant-maven-plugin:1.3.0:analyze failed: >More than one relationship[DECLARES, INCOMING] found for Node[80826] -> >[Help 1]

Maven 调试日志:

[INFO] Applying concept 'customJU:LambdaMethods' with severity: 'MINOR'.

[DEBUG] Executing query '
                 MATCH
  (type:Type)-[:DECLARES]->(lambda:Method)
WHERE
  exists(lambda.synthetic)
  and exists(lambda.static)
  and lambda.name starts with("lambda$")
SET
  lambda:Lambda
WITH
  type, lambda
MATCH
  (type)-[:DECLARES]->(method:Method)
WHERE
  method <> lambda
  and method.firstLineNumber <= lambda.firstLineNumber
  and method.lastLineNumber >= lambda.lastLineNumber
MERGE
  (method)-[:DECLARES]->(lambda)
RETURN
  method as lambdaMethod
        ' with parameters [{}]

似乎“MERGE (method)-[:DECLARES]->(lambda)”如果任一侧为空则失败。如何在合并前检查其是否有效合并?

两个答案:

  1. 我在扩展演示应用程序时偶然发现了同样的问题,只需更换

    MERGE
      (method)-[:DECLARES]->(lambda)
    

    MERGE
      (method)-[:DECLARES_LAMBDA]->(lambda)
    

    请注意,任何依赖 constraints/concepts 需要相应地更改为使用 DECLARES_LAMBDA 而不是 DECLARES。背后的原因是 DECLARES 关系的模糊性,jQAssistant 的报告机制无法处理。

  2. 您可以通过将以下插件配置添加到 pom.xml:

    来跳过单个 Maven 模块的执行
    <build>
        <plugins>
            <plugin>
                <groupId>com.buschmais.jqassistant</groupId>
                <artifactId>jqassistant-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    或者干脆

    <properties>
        <jqassistant.skip>true</jqassistant.skip>
    </properties>