Integrating with Ant

You can translate Java source files for projects that use an Ant build file. You can apply this integration on the command line without modifying the Ant build.xml file. When the build runs, OpenText SAST intercepts all javac task invocations and translates the Java source files as they are compiled. Make sure that you pass any properties to Ant by adding them to the ANT_OPTS environment variable. Do not include them in the sourceanalyzer command.

Note: You must translate any JSP files, configuration files, or any other non-Java source files that are part of the application in a separate step.

To use the Ant integration, make sure that the sourceanalyzer executable is in the PATH environment variable.

Prepend your Ant command-line with the sourceanalyzer command as follows:

sourceanalyzer -b <build_id> [<sca_options>] ant [<ant_options>]

For example, to translate a Java project and exclude a file from the translation:

sourceanalyzer -b MyProjectA -logfile MyProjectA.log -exclude src/module-info.java ant