4.3.1 Importing Java using the VerveineJ external parser
VerveineJ is a commercial MSE exporter built by synectique. It is a Java application based on JDT and it is available from the command line.
Here are the simple steps to take:
- Go to the root folder of your Java project (the one that includes all sources)
- Run the script to produce the MSE file:
verveinej.sh .
- Import the output.mse file into Moose (see Section 4.1)
The complete command line options for running VerveineJ take the following form:
verveinej.sh [ <jvm-options> -- ] [ <verveine-options> ] <java-source>
A useful option is the one that provides VerveineJ with more memory. For example, to allocate 2GB we can make use of the following incantation:
/PATH_TO_verveine.extractor.java/verveinej.sh -Xmx2000m -- .
This tells the extractor that we need the Java virtual machine to allocate 2GB, and to parse sources from the current directory.
What follows after —
are the VerveineJ specific options. The mandatory option is the source path specification. For example, in the above statement the path was ".". Besides the source path, it is also best to specify the complete Java classpath that should be considered when parsing the sources. This classpath should include all the libraries that are being used by the system. There are two ways to specify it:
-
cp A_CLASSPATH
enumerates a classpath explicitly; -
autocp A_ROOT_FOLDER
tells the parser that it should collect all jars recursively starting from the specified source path. This is useful in the case of projects that provide the library jars in sub-directories.
For example, to use both all jars from a $LIB_FOLDER
, and also those specified in a LOCALCLASSPATH
variable, we can use:
/PATH_TO_verveine.extractor.java/verveinej.sh -- -autocp . -cp $LOCALCLASSPATH .
To put it all together, a typical execution is to tell VerveineJ to use extra memory using the Java VM -Xmx
parameter, and to take into consideration all the libs from the current project. To do this, we specify to recursively load all jars starting from the current folder using autocp
:
/PATH_TO_verveine.extractor.java/verveinej.sh -Xmx2000m -- -autocp . .
The exported MSE model only contains the pointer to the source code, but not the actual source. Thus, when loading into Moose, you need to tell Moose where the root folder is (see Section 4.5). To get it working properly with Moose, the path should always be specified in a relative fashion. This is achieved by running VerveineJ from the root folder that needs to be analyzed, and by specifying the path as ".".
If you are interested, you can obtain the sources and compile the application as follows:
- Checkout the sources:
svn checkout svn://scm.gforge.inria.fr/svn/verveinej
- Go to the verveine.extractor.java folder and build the jar:
ant jar