0

I have a multi-module maven project with the following structure

myProject
  + parent
      - pom.xml
  + moduleA
      - pom.xml
  + moduleB
      - pom.xml

I would configure jqassistant in the parent directory the same way I did in a simple project. But I guess, that it wouldn't find any classes. Must I really declare all module references again with

<scanIncludes>
    <scanInclude>
        <path>../moduleA/target/classes</path>
        <scope>java:classpath</scope>
    </scanInclude>
</scanIncludes>

or is there a more cleaner approach? Do I must do additional steps?

niels
  • 7,321
  • 2
  • 38
  • 58

2 Answers2

0

If your modules (i.e. moduleA and moduleB) reference the parent via the parent-element of their pom.files it is sufficient to declare the jQAssistant Maven plugin once there in the plugins section. For an example of a multi-module project you can refer to https://github.com/buschmais/extended-objects/.

Dirk Mahler
  • 1,186
  • 1
  • 6
  • 7
  • It doesn't work for me. I get `Execution default of goal com.bu.....jqassistant:jqassistant-maven-plugin:1.2.0:scan failed: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, ...Parent\target\jqassistant\store: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@1ae9ae0' was successfully initialized, but failed to start. Please see attached cause exception. Unable to obtain lock on store lock file: ..Parent\target\jqassistant\store\store_lock. Please ensure no other process is using this database, and that the directory is writable (...): OverlappingFileLockException` – niels Mar 07 '17 at 19:26
  • Can you run "mvn install -Djqassistant.useExecutionRootAsProjectRoot" from the root module (myProject)? – Dirk Mahler Mar 07 '17 at 19:32
  • Solved the problem. How ever `mvn clean install -Djqassistant.useExecutionRootAsProjectRoot` doesn't work. I think therefore I must put the store to another directory. Must investigate it later. – niels Mar 07 '17 at 20:45
  • Did you specify the store (database) directory directly? – Dirk Mahler Mar 08 '17 at 05:47
  • Just an explanation: jQAssistant uses one store per project, within a consistent parent hierarchy this is the reactor. Therefore the database is created in the target directory of the up-most parent module. The embedded Neo4j instance is started once and re-used. This is not as trivial as it seems, and depending on the project structure this sometimes may cause problems like yours. It would be good to see why this is happening for you, is the project somewhere available that we can have a look at it? – Dirk Mahler Mar 08 '17 at 06:00
  • Everything is fine. `mvn install -Djqassistant.useExecutionRootAsProjectRoot` works. Only the combination with `clean` can't work, because it tries to remove the store which is used by the other modules. At the moment I use the default directory, but I think to solve this small issue it's a good idea to declare the directory directly. – niels Mar 08 '17 at 17:39
0

There is no need for special scan includes. However it's necessary to set jqassistant.useExecutionRootAsProjectRoot to true. This can be done via system property -Djqassistant.useExecutionRootAsProjectRoot or <useExecutionRootAsProjectRoot>true</useExecutionRootAsProjectRoot> in the configuration section of the pom.xml. If you run a jquasssitant goal directly for example jqassistant:server you must set the system property. If you often use mvn clean install it's important to store the neo4j-database outside of the target-directory. Otherwise the last clean will fail. You can achieve this with <storeDirectory>${project.build.directory}/../../store</storeDirectory>. With -DstoreDirectory it doesn't seems to work.

niels
  • 7,321
  • 2
  • 38
  • 58