mavenjqassistant

jQAssistant - scanInclude Maven artifact


I have a project with the following structure:

myProject
  + Annotations
      - pom.xml
  + projectA
      + jqassistant
          -my-rules.xml 
      - pom.xml

There are dependencies between the two, as some classes from the project A are annotated with custom annotations from Annotations. The current configuration in projectA's pom looks like this:

<configuration>
            <concepts>
                    <concept>classpath:Resolve</concept>
            </concepts>
            <scanIncludes>
                <scanInclude>
                    <path>../Annotations/target/classes</path>
                    <scope>java:classpath</scope>
                </scanInclude>
            </scanIncludes>
            [...]
</configuration>

Everything works fine, but now I want to use Annotations as a maven artifact via URL to the repository, so I don't have to manually add it to every project.

So I am looking for something like this:

<scanInclude>
   <path>https://...</path>
   <scope>java:classpath</scope>
</scanInclude>

If I understand the Manual (https://buschmais.github.io/jqassistant/doc/1.2.0/) correctly, scanIncludes only works for directories/files, but not URLs.

Is there an easy solution to do that?


Solution

  • At this moment scanning URLs sadly is not supported. Your only chance at this moment is to use the Maven dependency plugin to copy the dependency to your project's target folder (see https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html) and scan it from there as you did before.

    By the way there's good news: in one of the following releases it will be possible to include dependencies into the scan of a Maven project by specifying an artifact filter.

    BTW: If you only need to see where your annotations are used in the code of your project it is not necessary to scan the artifact containing your annotation classes (probably you don't scan tha JPA API-Jar but use the annotations provided from there as well in concepts). You still get the pattern (e)-[:ANNOTATED_BY]->(a:Annotation)-[:OF_TYPE]->(t:Type), the only difference is that t will be a node that only provides the property fqn, i.e the fully qualified class name of the annotation type.