I can't make jQAssistant process an XML file as such

115 views
Skip to first unread message

Mikel Alejo

unread,
May 27, 2019, 11:33:32 AM5/27/19
to jQAssistant
Hello there!

I'm playing around with jQAssistant and I'm trying to make it parse an XML file, but I am unable to do so. Running mvn install or mvn jqassistant:scan yields the following debug messages:

[DEBUG] Scanning /Info.xml
[DEBUG] Cache miss for discriminators [Java, Package, File, Directory].

And running

MATCH (f:Xml) RETURN f.fileName

Doesn't return the "Info.xml" file. It's as if the file were not parsed as an XML file. The file in question —src/main/resources/Info.xml— has the following contents:

<?xml version="1.0" encoding="UTF-8"?>

<customXml>
   <info>
       <sub>one</sub>
       <sub>two</sub>
       <sub>three</sub>
   </info>
</customXml>

And my pom.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>

 <modelVersion>4.0.0</modelVersion>

  <groupId>org.myorg.helloworld</groupId>
 <artifactId>hello-world</artifactId>
 <version>1.0-SNAPSHOT</version>

  <name>hello-world</name>
 <!-- FIXME change it to the project's website -->

  <properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   <maven.compiler.source>1.7</maven.compiler.source>
   <maven.compiler.target>1.7</maven.compiler.target>
 </properties>

  <dependencies>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.11</version>
     <scope>test</scope>
   </dependency>
 </dependencies>

  <build>
   <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
     <plugins>
       <plugin>
         <artifactId>maven-clean-plugin</artifactId>
         <version>3.1.0</version>
       </plugin>
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <version>3.0.2</version>
       </plugin>
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.8.0</version>
       </plugin>
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.22.1</version>
       </plugin>
       <plugin>
         <artifactId>maven-jar-plugin</artifactId>
         <version>3.0.2</version>
       </plugin>
       <plugin>
         <artifactId>maven-install-plugin</artifactId>
         <version>2.5.2</version>
       </plugin>
       <plugin>
         <artifactId>maven-deploy-plugin</artifactId>
         <version>2.8.2</version>
       </plugin>
       <plugin>
         <artifactId>maven-site-plugin</artifactId>
         <version>3.7.1</version>
       </plugin>
       <plugin>
         <artifactId>maven-project-info-reports-plugin</artifactId>
         <version>3.0.0</version>
       </plugin>
     </plugins>
   </pluginManagement>
   <plugins>
     <plugin>
       <groupId>com.buschmais.jqassistant</groupId>
       <artifactId>jqassistant-maven-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>scan</goal>
             <goal>analyze</goal>
           </goals>
           <configuration>
             <warnOnSeverity>MINOR</warnOnSeverity>
             <failOnSeverity>MAJOR</failOnSeverity>
             <failOnViolations>true</failOnViolations>
             <scanIncludes>
               <scanInclude>
                 <path>.git</path>
               </scanInclude>
             </scanIncludes>
             <scanProperties>
               <xml.file.include>*.xml</xml.file.include>
             </scanProperties>
           </configuration>
         </execution>
       </executions>
       <dependencies>
         <dependency>
           <groupId>de.kontext-e.jqassistant.plugin</groupId>
           <artifactId>jqassistant.plugin.git</artifactId>
           <version>1.6.1</version>
         </dependency>
       </dependencies>
     </plugin>
   </plugins>
 </build>

  <reporting>
   <plugins>
     <plugin>
       <groupId>com.buschmais.jqassistant</groupId>
       <artifactId>jqassistant-maven-plugin</artifactId>
       <reportSets>
         <reportSet>
           <reports>
             <report>report</report>
           </reports>
         </reportSet>
       </reportSets>
     </plugin>
   </plugins>
 </reporting>
</project>

I've tried with an absolute path to the file and doesn't work either. I also tried setting the absolute path inside a <scanInclude><path> but with no luck. I ended up moving the XML file to resources/ following the example I found on github.com/IsyFact/isyfact-jqassistant-plugin, with no luck. So I'm pretty sure I'm misconfiguring something, but I cannot figure out what. Any ideas of what could it be?

Thank you in advance.

Oliver B. Fischer

unread,
May 28, 2019, 6:20:16 AM5/28/19
to jqass...@googlegroups.com, Mikel Alejo

I will have a look at it today.

BTW: Is the project available (Bitbucket, Gitlab, Zip)...?

Am 27.05.19 um 17:33 schrieb Mikel Alejo:
--
You received this message because you are subscribed to the Google Groups "jQAssistant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jqassistant...@googlegroups.com.
To post to this group, send email to jqass...@googlegroups.com.
Visit this group at https://groups.google.com/group/jqassistant.
To view this discussion on the web visit https://groups.google.com/d/msgid/jqassistant/7e65119e-2ff5-4af1-9f48-4242dc8fe782%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- 
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538 
E o.b.f...@swe-blog.net 
S oliver.b.fischer
J oliver.b...@jabber.org
X http://xing.to/obf
signature.asc

Mikel Alejo

unread,
May 28, 2019, 8:51:07 AM5/28/19
to Oliver B. Fischer, jqass...@googlegroups.com
> I will have a look at it today.

Thanks!

> BTW: Is the project available (Bitbucket, Gitlab, Zip)..

Sure, the code can be found here:
https://github.com/MikelAlejoBR/jqassistant-hello-world/tree/feature-read-xml


On 28/5/19 12:20, Oliver B. Fischer wrote:
> I will have a look at it today.
>
> BTW: Is the project available (Bitbucket, Gitlab, Zip)...?
>
> Am 27.05.19 um 17:33 schrieb Mikel Alejo:
>> Hello there!
>>
>> I'm playing around with jQAssistant and I'm trying to make it parse an
>> XML file, but I am unable to do so. Running /mvn install/ or /mvn
>> jqassistant:scan/ yields the following debug messages:
>>
>> |
>> [DEBUG]Scanning/Info.xml
>> [DEBUG]Cachemiss fordiscriminators [Java,Package,File,Directory].
>> |
>>
>> And running
>>
>> |
>> MATCH (f:Xml)RETURN f.fileName
>> |
>>
>> Doesn't return the "Info.xml" file. It's as if the file were not
>> parsed as an XML file. The file in question
>> —/src/main/resources/Info.xml/— has the following contents:
>>
>> |
>> <?xmlversion="1.0"encoding="UTF-8"?>
>> <customXml>
>> <info>
>> <sub>one</sub>
>> <sub>two</sub>
>> <sub>three</sub>
>> </info>
>> </customXml>
>> |
>>
>> And my /pom.xml/ looks like this:
>>
>> |
>> <?xmlversion="1.0"encoding="UTF-8"?>
>> <projectxmlns="http://maven.apache.org/POM/4.0.0
>> <http://maven.apache.org/POM/4.0.0>
>> http://maven.apache.org/xsd/maven-4.0.0.xsd
>> I also tried setting the absolute path inside a /<scanInclude><path>/
>> but with no luck. I ended up moving the XML file to /resources//
>> following the example I found on
>> github.com/IsyFact/isyfact-jqassistant-plugin
>> <https://github.com/IsyFact/isyfact-jqassistant-plugin/blob/master/Readme.adoc>,
>> with no luck. So I'm pretty sure I'm misconfiguring something, but I
>> cannot figure out what. Any ideas of what could it be?
>>
>> Thank you in advance.
>> --
>> You received this message because you are subscribed to the Google
>> Groups "jQAssistant" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to jqassistant...@googlegroups.com
>> <mailto:jqassistant...@googlegroups.com>.
>> To post to this group, send email to jqass...@googlegroups.com
>> <mailto:jqass...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/jqassistant/7e65119e-2ff5-4af1-9f48-4242dc8fe782%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> Eo.b.f...@swe-blog.net
> S oliver.b.fischer
> Joliver....@jabber.org
> Xhttp://xing.to/obf
>

Dirk Mahler

unread,
May 29, 2019, 2:21:38 AM5/29/19
to jqass...@googlegroups.com
Hi Mikel,

the plugin responsible for scanning XML requires a file pattern to be activated, i.e. in <scanProperties/> in the configuration section of the jQAssistant Maven Plugin:

<configuration>
  <scanProperties
    <xml.file.include>**/*.xml</xml.file.include>
  </scanProperties>
  ...
</configuration>

The reason behind this is that some (enterprise) projects contain very large XML files that just would slow down scanning without adding any value for analysis qwith jQA. We should consider to invert the default behavior such that all *.xml files should be included by default and a user needs to handle such extra situations using the property "xml.file.exclude" (see also http://buschmais.github.io/jqassistant/doc/1.6.0/#XmlFileScanner).

Cheers

Dirk


------ Originalnachricht ------
Von: "Mikel Alejo" <mabarc...@ikasle.ehu.eus>
An: "jQAssistant" <jqass...@googlegroups.com>
Gesendet: 27.05.2019 17:33:31
Betreff: [jQAssistant] I can't make jQAssistant process an XML file as such

--
You received this message because you are subscribed to the Google Groups "jQAssistant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jqassistant...@googlegroups.com.
To post to this group, send email to jqass...@googlegroups.com.

Oliver B. Fischer

unread,
May 29, 2019, 3:07:35 AM5/29/19
to jqass...@googlegroups.com, Dirk Mahler

Hi Mikel,

does this solve your problem?

Oliver


Am 29.05.19 um 08:21 schrieb Dirk Mahler:

For more options, visit https://groups.google.com/d/optout.
-- 
N Oliver B. Fischer
A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
P +49 30 44793251
M +49 178 7903538
signature.asc

Mikel Alejo

unread,
May 29, 2019, 5:48:57 AM5/29/19
to Oliver B. Fischer, jqass...@googlegroups.com, Dirk Mahler
Hello again,

Thanks for your help but it doesn't solve the problem ☹

I have updated my pom.xml —changes are pushed to the repo if you want to
try it by yourself— and then performed a mvn jqassistant:scan -X. I get:

[DEBUG] Scanning /Info.xml
[DEBUG] Scanning /org
[DEBUG] Cache miss for discriminators [Java, Package, File, Directory].

And running a:

MATCH (f:Xml) RETURN f.fileName

and

MATCH (f:Xml) WHERE f.fileName contains "Info" RETURN f;

but it doesn't return anything related to "Info.xml". I also tried:

MATCH (e:Xml:Element) WHERE e.name CONTAINS "custom" RETURN e

As the "Info.xml" contains a <customXml> element but no results are
returned 🙁
>> <mailto:mabarc...@ikasle.ehu.eus>>
>> An: "jQAssistant" <jqass...@googlegroups.com
>> <mailto:jqass...@googlegroups.com>>
>> Gesendet: 27.05.2019 17:33:31
>> Betreff: [jQAssistant] I can't make jQAssistant process an XML file as
>> such
>>
>>> Hello there!
>>>
>>> I'm playing around with jQAssistant and I'm trying to make it parse
>>> an XML file, but I am unable to do so. Running /mvn install/ or /mvn
>>> jqassistant:scan/ yields the following debug messages:
>>>
>>> |
>>> [DEBUG] Scanning /Info.xml
>>> [DEBUG] Cache miss for discriminators [Java, Package, File, Directory].
>>> |
>>>
>>> And running
>>>
>>> |
>>> MATCH (f:Xml) RETURN f.fileName
>>> |
>>>
>>> Doesn't return the "Info.xml" file. It's as if the file were not
>>> parsed as an XML file. The file in question
>>> —/src/main/resources/Info.xml/— has the following contents:
>>>
>>> |
>>> <?xmlversion="1.0"encoding="UTF-8"?>
>>> <customXml>
>>> <info>
>>> <sub>one</sub>
>>> <sub>two</sub>
>>> <sub>three</sub>
>>> </info>
>>> </customXml>
>>> |
>>>
>>> And my /pom.xml/ looks like this:
>>>
>>> |
>>> <?xmlversion="1.0"encoding="UTF-8"?>
>>> <projectxmlns="http://maven.apache.org/POM/4.0.0
>>> <http://maven.apache.org/POM/4.0.0>
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd
>>> I also tried setting the absolute path inside a /<scanInclude><path>/
>>> but with no luck. I ended up moving the XML file to /resources//
>>> following the example I found on
>>> github.com/IsyFact/isyfact-jqassistant-plugin
>>> <https://github.com/IsyFact/isyfact-jqassistant-plugin/blob/master/Readme.adoc>,
>>> with no luck. So I'm pretty sure I'm misconfiguring something, but I
>>> cannot figure out what. Any ideas of what could it be?
>>>
>>> Thank you in advance.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jQAssistant" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to jqassistant...@googlegroups.com
>>> <mailto:jqassistant...@googlegroups.com>.
>>> To post to this group, send email to jqass...@googlegroups.com
>>> <mailto:jqass...@googlegroups.com>.
>>> <https://groups.google.com/d/msgid/jqassistant/7e65119e-2ff5-4af1-9f48-4242dc8fe782%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>> For more options, visit https://groups.google.com/d/optout.
>> --
>> You received this message because you are subscribed to the Google
>> Groups "jQAssistant" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to jqassistant...@googlegroups.com
>> <mailto:jqassistant...@googlegroups.com>.
>> To post to this group, send email to jqass...@googlegroups.com
>> <mailto:jqass...@googlegroups.com>.
>> Visit this group at https://groups.google.com/group/jqassistant.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jqassistant/em53b3d9b2-e943-4b54-98ec-58a6642659de%40mythenmetz-jr
>> <https://groups.google.com/d/msgid/jqassistant/em53b3d9b2-e943-4b54-98ec-58a6642659de%40mythenmetz-jr?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> N Oliver B. Fischer
> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany
> P +49 30 44793251
> M +49 178 7903538
> Eo.b.f...@swe-blog.net
> S oliver.b.fischer
> Joliver....@jabber.org
> Xhttp://xing.to/obf
>
> --
> You received this message because you are subscribed to the Google
> Groups "jQAssistant" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jqassistant...@googlegroups.com
> <mailto:jqassistant...@googlegroups.com>.
> To post to this group, send email to jqass...@googlegroups.com
> <mailto:jqass...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/jqassistant.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jqassistant/90885932-2059-cef5-0285-9992eacbe226%40swe-blog.net
> <https://groups.google.com/d/msgid/jqassistant/90885932-2059-cef5-0285-9992eacbe226%40swe-blog.net?utm_medium=email&utm_source=footer>.

Mikel Alejo

unread,
May 29, 2019, 10:14:44 AM5/29/19
to Oliver B. Fischer, jqass...@googlegroups.com, Dirk Mahler
Okay, my fault. I just discovered why jQAssistant wasn't importing the
XML file:

I was doing "mvn jqassistant:scan instead" of "mvn install". By doing
the latter, plus the config tweak Dirk pointed out, everything works
flawlessly. The XML file and its contents are correctly imported.

I've realized that the same thing happens with the Git plugin. It only
works on "mvn install". Probably I misread some key info in the docs.

So thank you for your time and patience :)

Kind regards,
Mikel Alejo.

Dirk Mahler

unread,
May 29, 2019, 11:08:54 AM5/29/19
to jqass...@googlegroups.com
Good to read!

For allowing jqassistant:scan on the command line to pick up your configuration just add the id "default-cli" to the execution in your pom.xml:

<plugin>
<groupId>com.buschmais.jqassistant</groupId>
<artifactId>jqassistant-maven-plugin</artifactId>
    <version>${jqassistant.version}</version>
<executions>
<execution>
<id>default-cli</id>

<goals>
<goal>scan</goal>
<goal>analyze</goal>
</goals>
<configuration>
...

Cheers,

Dirk

------ Originalnachricht ------
Von: "Mikel Alejo" <mabarc...@ikasle.ehu.eus>
An: "Oliver B. Fischer" <o.b.f...@swe-blog.net>; jqass...@googlegroups.com; "Dirk Mahler" <dirk....@buschmais.com>
Gesendet: 29.05.2019 16:14:42
Betreff: Re: [jQAssistant] I can't make jQAssistant process an XML file as such

To unsubscribe from this group and stop receiving emails from it, send an email to jqassistant...@googlegroups.com.
To post to this group, send email to jqass...@googlegroups.com.

Mikel Alejo

unread,
May 30, 2019, 6:02:06 AM5/30/19
to jqass...@googlegroups.com, Dirk Mahler
Reply all
Reply to author
Forward
0 new messages