Format of the build specification file for Java projects
The Klocwork build specification for Java projects, called kwinject.out by default, is a semicolon-separated text file containing the following information about the Java source files in your Klocwork project:
- the classpath and Java version for the javac invocation, identified in jconfig lines
- the source Java files that were compiled, identified in jcompile lines
- the jar files and their input files, identified in the jar lines
The first field of each line is a tag to identify the type of line. The possible tags are as follows:
|build specification format version
|used to define Java compiler options, such as Java version and classpath
|used to specify compiled source files
|used to specify jar files and their input files
The version line is used to define the build specification format version. It must be the first line in the build specification. Only one version line may appear in a build specification.
Version 1.4 or later indicates that the build specification was generated using a source encoding of UTF-8, allowing multibyte characters (for example, Japanese). To ensure that kwbuildproject processes the build specification with UTF-8 encoding, the version must be version;104 or later.
The jconfig line is used to identify Java compiler options — the Java version and default classpath.
Example jconfig line:
jconfig;c:\program files\java\jdk1.7.0_67\bin\javac.exe;-classpath;c:\program files\java\jdk1.7.0_67\jre\lib\resources.jar%3Bc:\program files\java\jdk1.7.0_67\jre\lib\rt.jar;-source;1.7
There are three fields:
|tag for jconfig lines
|path to javac compiler (for example, /opt/sun1.7/bin/javac)
|a list of separated compiler options listing the source version and classpath,-classpath;/space/testing/java/jdk1.7.0_25/jre/lib/resources.jar:/space/testing/java/jdk1.7.0_25/jre/lib/rt.jar;-source;1.7) The classpath entries are separated by ":" on Unix machines, or "%3B" for Windows.
Each jcompile line is used to track Java source file compilation.
The fields are:
|tag for jcompile lines
|full path to the javac executable
|directory with the resulting .class file or full path to the target .jar file
|full path name of the source file
Each jar line is used to track jar execution, in other words, how .jar files are created.
The fields are:
|tag for jar lines
|full path to the output .jar file
|semi-colon-separated list of .class files and/or directories and/or .jar files.