MVN Plugin

From Lingoport Wiki
Revision as of 17:53, 6 September 2016 by Olibouban (talk | contribs) (Multi-Scan Projects)
Jump to: navigation, search

Globalyzer has a number of clients: The Workbench, the command line interface, Lite, the Ant client, and the MVN plugin. When using a MVN project, you can add code scanning with Globalyzer using our MVN plugin. It is well suited for use within automation routines and Continuous Integration (CI) systems as well as within a typical developer environment, for instance within an Integrated Development Environments (IDEs).

The Globalyzer MVN plugin generates scan reports to a directory specified the pom.xml file. Scan reports are available in a variety of formats. We ask our MVN customers to install the MVN plugin in a private MVN repository for that company.

The steps to use the Globalyzer MVN plugin are the same as any MVN plugin:

  • Install the plugin
  • Configure the pom.xml
  • Run MVN


Install the Globalyzer MVN Plugin

For those customers who require the MVN plugin, we make the globalyzer-mvn-plugin-x.y.z.jar file available for download. We ask that this jar file be installed in a private MVN repository at the customer's side.


Configure the Globalyzer MVN Plugin

The <build><plugins> section of your module's pom.xml file must be configured. Here is how:

 <plugin>
 <groupId>com.lingoport.globalyzer.client.maven</groupId>
 <artifactId>globalyzer-maven-plugin</artifactId>
 <version>5.2.1</version>
 <configuration>
     -required- 
     <username>joe@company.com</username>
     <password>joespw</password>
     <ruleSetName>Java Rule Set</ruleSetName>
     -optional-
     <serverUrl></serverUrl>  (default: https://www.globalyzer.com/gzserver)     
     <dataDictionaryDir></dataDictionaryDir>  ( default: userhome/.globalyzer )    
     <projectName></projectName>  ( default: project artifact )    
     <projectDir></projectDir>  ( default: project src/main/java )
     <ruleSetOwner></ruleSetOwner>  ( default: username )
     <scanName></scanName>  ( default: auto-generate )
     <scanTimeout></scanTimeout>  ( default: 120 seconds )
     <filterWithDictionary></filterWithDictionary> ( default: true )
     <reportType></reportType>  ( default: ScanDetailedXML )
     <reportPath></reportPath>  ( default: target/i18n )
     <setLog4jProperties></setLog4jProperties>  ( default: true )
     <log4jPropertiesFileDir></log4jPropertiesFileDir> ( default: Globalyzer provided )              
 </configuration>
 </plugin>

Running Globalyzer MVN Plugin From The Command Prompt / Shell

Globalyzer MVN Plugin can be executed from a command prompt or shell via the following command:

mvn com.lingoport.globalyzer.client.maven:globalyzer-maven-plugin:5.2:scan

After MVN finishes each scan, a Globalyzer report per scan is created at the location specified in the pom.xml report path. The default location for the reports are target/i18n for each MVN module.


Multi-Threaded Support

The Globalyzer MVN plugin supports multi-threaded invocation. For instance, on multi-module projects, use the -T option. For instance:

mvn com.lingoport.globalyzer.client.maven:globalyzer-maven-plugin:5.2.1:scan -Pglobalyzer -T 1.0C

Multi-Scan Projects

To execute more than one scan on a MVN project, use "execution goals":

 <plugin>
       <groupId>com.lingoport.globalyzer.client.maven</groupId>
       <artifactId>globalyzer-maven-plugin</artifactId>
       <version>5.2</version>
       <executions>
         <execution>
           <id>execution1</id>
           <phase>validate</phase>
             <configuration>
             <username>bob@yourcompany.com</username>
             <password>bobpassword</password>
             <ruleSetName>testjava</ruleSetName>
             <scanName>java-report</scanName>
             </configuration>
              <goals>
                 <goal>scan</goal>
             </goals>            
         </execution>
         <execution>
         <id>execution2</id>
          <phase>validate</phase>
           <configuration>
             <username>bob@yourcompany.com</username>
             <password>bobpassword</password>
             <ruleSetName>testjavascript</ruleSetName>
             <scanName>javascript-report</scanName>
            </configuration>
            <goals>
              <goal>scan</goal>
            </goals>
         </execution>
       </executions>                  
 </plugin>

Sharing pom.xml Files Between IDEs and Build Systems

It is common to check in a single pom.xml per code repository. However, some configuration on a developer's laptop may be different from a build system.

A possibility to bridge the environment is to keep the most Globalyzer specific configuration only in the pom.xml file and to move the system side in the settings.xml file.