Troubleshoot Ant errors

2020/12/1 |

Symptoms

When you scan a Java application in Lucent Sky AVM and the JavaBuild scan argument is not set or set to Ant, the scan fails with the following errors:

One or more Ant build errors occurred when building the application. (-42220040)

One or more Ant build errors occurred when building the application. (-42220041)

In addition, Ant build log contains the following message:

BUILD FAILED

Cause

When scanning a Java application and the JavaBuild scan argument is not set or set to Ant, Apache Ant is used to build the application. If errors occurred during Ant build, the scan fails.

Resolution

To resolve this issue, use the following methods starting with the first method below. If that does not resolve the issue, try the next method.

Method 1

Resolve errors in Ant logs, then scan the application again.

To learn more about common types of Ant errors, see the More Information section.

Method 2

Use direct binary analysis to scan Java applications without building them in Lucent Sky AVM. To learn more about how to use direct binary analysis, view the following article in the Lucent Sky Knowledge Base:
Scan an application using direct binary analysis

Method 3

To disable binary analysis and only use source code analysis to scan a Java application, include AnalysisEngines,20 in scan arguments.

More Information

When a build file (such as build.xml) is not specified, Lucent Sky AVM attempts to find a build file in the source code archive. If a build file is found, a modified copy of the build file is created for use in the build process to improve its compatibility. However, this modification might instead cause the application fail to build. To use a specific build file as it is in the build process, specify the relative path to the build file in the source code archive in Analysis Target.

Common types of Ant build errors include:

  • A package does not exist or a symbol cannot be found - javac could not find the JAR library containing the namespace or class listed in the error message. Place the required JAR library in the lib directory of the application. findJAR.com might be helpful in locating the JAR library containing a certain class file.
  • Syntax and semantic errors - There are two common causes of syntax and sematic errors in a JDK compilation, either that there are actual syntax and semantic errors in the source code, or the source code was compiled with an incorrect encoding. For more information on how to resolve encoding problems, view the following article in the Lucent Sky Knowledge Base:
    Troubleshoot encoding problems