When running MUnit tests in a MuleSoft project that uses the SAP Connector, tests may fail because the SAP native libraries (sapjco3.jar, sapidoc3.jar, libsapjco3.so) are not found at the path specified in the munit-tests Maven profile.
The root cause has two contributing factors:
munit-tests profile's sap.path points to ${project.basedir}/src/main/mule/lib, but the SAP libraries are copied by the maven-dependency-plugin to ${project.build.directory}/lib during the process-sources phase. Since MUnit tests execute before the libraries are copied to the target/ directory, Maven cannot resolve the SAP dependencies.This results in errors such as:
Could not find artifact com.sap.conn.idoc:com.sap.conn.idoc.sapidoc3:jar:3.1.4 at specified path /home/vsts/work/1/s/src/main/mule/lib/sapidoc3.jar
dependency: com.sap.conn.jco:com.sap.conn.jco.sapjco3:jar:3.1.12 (system)
Because the SAP Connector initializes its configuration regardless of mocking, the fix requires a two-step build approach:
Run the following commands in order:
Run a full Maven build first to ensure all SAP libraries are copied to ${project.build.directory}/lib before any tests execute.
mvn clean package -DskipTests
munit-tests Profile and Run TestsUpdate the sap.path property in the munit-tests profile in your pom.xml to point to the correct target/lib directory, then run:
mvn test -P munit-tests
This aligns the dependency path with the actual location where the SAP libraries are copied during the build process.
005388152

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.