微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jQAssistant:商店重置是如何工作的?

如何解决jQAssistant:商店重置是如何工作的?

我想为我们的团队使用 jQAssistant。我根据 https://101.jqassistant.org/setting-up-a-team-server/index.html 安装了它,所以我有一个独立于 jQAssistant 运行的外部 Neo4j 商店。

我想在每晚构建期间扫描我们的软件并获得最新信息。所以我的想法是在每晚构建之前使用重置:

<!-- Use this profile to reset the jQAssistant store (database) -->
<profile>
  <id>jqassistant-reset</id>
  <build>
    <plugins>
      <plugin>
        <groupId>com.buschmais.jqassistant</groupId>
        <artifactId>jqassistant-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>reset-store</id>
            <phase>clean</phase>
            <goals>
              <goal>reset</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

然后我会检查每个 Maven 模块并扫描它:

  <pluginManagement>
    <plugin>
      <groupId>com.buschmais.jqassistant</groupId>
      <artifactId>jqassistant-maven-plugin</artifactId>
      <version>1.9.1</version>
      <configuration>
        <store>
          <uri>bolt://my-neo4j-store.com:7687</uri>
          <username>neo4j</username>
          <password>reallysecret</password>
          <encryption>false</encryption>
        </store>
        <configuration>
          <resetStore>false</resetStore>
        </configuration>
        <continueOnError>true</continueOnError>
      </configuration>
    </plugin>
  </pluginManagement>

...


<!-- Use this profile to gather information using jQAssistant -->
<profile>
  <id>jqassistant</id>
  <build>
    <plugins>
      <plugin>
        <groupId>com.buschmais.jqassistant</groupId>
        <artifactId>jqassistant-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>scan-software</id>
            <phase>package</phase>
            <goals>
              <goal>scan</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

但是,我看到了令人困惑的日志消息:

[INFO] --- jqassistant-maven-plugin:1.9.1:scan (scan-software) @ foobar ---
[INFO] Scanning for jQAssistant plugins...
[INFO] [asciidoc Report,CDI,Common,Core Analysis,Core Report,EJB3,GraphML,GraphQL,JAX-RS,JPA 2,JSON,JUnit,Java,Java EE 6,Maven 2 Repository,Maven 3,Osgi,RDBMS,Spring,TestNG,Tycho,XML,YAML].
[INFO] Connecting to store at 'bolt://my-neo4j-store.com:7687' (username=neo4j)
Jul 12,2021 9:46:59 AM org.neo4j.driver.internal.logging.JULogger info
informatION: Direct driver instance 839477204 created for server address my-neo4j-store.com:7687
[INFO] Resetting store.
[INFO] Reset finished (removed 0 nodes,0 relations).
[INFO] Entering /foobar/target/classes
[INFO] Leaving /foobar/target/classes (70 entries,307558 ms)
[INFO] Entering /foobar/target/test-classes
[INFO] Leaving /foobar/target/test-classes (70 entries,1422 ms)
[INFO] Entering /foobar/target/surefire-reports
[INFO] Leaving /foobar/target/surefire-reports (46 entries,1127 ms)

我不明白为什么我会看到 Resetting store.,尽管我已在配置中将其关闭

然而,更令我困惑的是,当再次启动 Maven 构建时,我看到了:

[INFO] Resetting store.
[INFO] Reset finished (removed 0 nodes,0 relations).

我刚刚用第一个构建填充了商店,现在在第二个构建中,插件告诉我它重置了商店,但没有删除任何节点或关系。

有人可以解释一下我如何才能实现我想要做的事情吗?

解决方法

定义的行为是在扫描反应堆构建的第一个模块之前重置存储。因此,如果可以在同一个构建反应器中扫描所有必需的模块,则通常不需要显式重置行为。

反之亦然:如果要扩展来自先前反应堆构建的现有扫描,则必须为构建反应堆内的扫描(例如 mvn package 命令)停用重置。

可以通过重置标志控制扫描目标的重置行为:

<plugin>
  <groupId>com.buschmais.jqassistant</groupId>
  <artifactId>jqassistant-maven-plugin</artifactId>
  <configuration>
    <store>
      <uri>bolt://my-neo4j-store.com:7687</uri>
      <username>neo4j</username>
      <password>reallysecret</password>
      <encryption>false</encryption>
    </store>

    <reset>false</reset> <!-- true is the default setting to clear the store at the beginning of each reactor build -->

  </configuration>
</plugin>

请更新您的配置(您在另一个 resetStore 部分中使用了 configuration)。

,

啊,现在我知道问题出在哪里了:重置商店的配置称为reset不是 resetStore。当我按照 Dirk Mahler 的建议使用 reset 时,一切正常!

我读了 looking at the source 而不是 documentation,这是错误的。我会在 GitHub 上写一个 bug。

德克,非常感谢支持!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。