|
| 1 | += Configure External Libraries for Mule Projects |
| 2 | +:page-deployment-options: cloud-ide, desktop-ide |
| 3 | + |
| 4 | +External libraries are project-level dependencies that Mule applications require to support certain connectors and components, such as Database connectors or Spring-based components. |
| 5 | +Anypoint Code Builder provides a guided interface to add, edit, and delete external libraries, and automatically manages the corresponding entries in the project POM file. |
| 6 | + |
| 7 | +External library configurations apply at the project level. Any change to a configured library affects all components in the project that require that library. |
| 8 | + |
| 9 | +== Before You Begin |
| 10 | + |
| 11 | +* xref:start-acb.adoc[]. |
| 12 | +* xref:int-create-integrations.adoc[]. |
| 13 | +* Add a connector or component that requires an external library, such as a Database or Spring component. |
| 14 | + |
| 15 | +== When You Need to Configure an External Library |
| 16 | + |
| 17 | +Anypoint Code Builder prompts you to configure an external library when you add or configure a component that requires additional dependencies. |
| 18 | +For example, this can occur when you: |
| 19 | + |
| 20 | +* Add a Database connector connection |
| 21 | +* Configure a Spring-based component |
| 22 | +* Use a custom component that depends on external libraries |
| 23 | + |
| 24 | +You can also manage external libraries from the project-level configuration, independent of a specific component. |
| 25 | + |
| 26 | +== Add an External Library |
| 27 | + |
| 28 | +You can add an external library from the component configuration or from the project-level library configuration interface. |
| 29 | + |
| 30 | +Add external libraries from one of these sources: |
| 31 | + |
| 32 | +* Recommended libraries |
| 33 | +* Maven dependencies |
| 34 | +* Local files |
| 35 | + |
| 36 | +Open the library configuration interface from a component: |
| 37 | + |
| 38 | +. In the canvas, select a component that requires an external library. |
| 39 | +. In the component configuration panel, locate the *Required Libraries* list. |
| 40 | +. Click the *Configure library* icon. |
| 41 | ++ |
| 42 | +Anypoint Code Builder opens the *Library Configuration* page. |
| 43 | +Changes made on this page apply to the entire project. |
| 44 | + |
| 45 | +=== Add a Recommended Library |
| 46 | + |
| 47 | +Some components provide recommended libraries that match the component requirements. |
| 48 | + |
| 49 | +. Open the *Library Configuration* page. |
| 50 | +. Select *Add Recommended Library*. |
| 51 | ++ |
| 52 | +The interface shows the library to add to the project. |
| 53 | +. Click *Apply*. |
| 54 | ++ |
| 55 | +The IDE adds the recommended library to the project POM file and applies it to all components that require it. |
| 56 | + |
| 57 | +=== Add a Maven Dependency |
| 58 | + |
| 59 | +Search Maven Central or manually specify Maven coordinates to add a dependency. |
| 60 | + |
| 61 | +. Open the *Library Configuration* page. |
| 62 | +. Select *Add Maven Dependency*. |
| 63 | +. In the *Search Maven Central Repository* field, search for a dependency or enter the required Maven fields manually. |
| 64 | +. Specify values for *Group ID*, *Artifact ID*, and *Version*. |
| 65 | +. Optionally, configure additional fields such as *Scope*. |
| 66 | +. Click *Apply*. |
| 67 | + |
| 68 | +Only libraries that meet the required criteria appear in component library fields after configuration. |
| 69 | + |
| 70 | +=== Add a Library from a Local File |
| 71 | + |
| 72 | +Add a dependency from a local file, such as a JAR or an external POM file. |
| 73 | + |
| 74 | +. Open the *Library Configuration* page. |
| 75 | +. Select *Add from Local File*. |
| 76 | +. Select a file from your system. |
| 77 | ++ |
| 78 | +Anypoint Code Builder automatically populates the Maven fields based on the selected file. |
| 79 | +. Override the populated values if required. |
| 80 | +. Click *Apply*. |
| 81 | + |
| 82 | +If you select an external POM file, it takes precedence over any POM embedded in the artifact file. |
| 83 | + |
| 84 | +== Edit or Delete an External Library |
| 85 | + |
| 86 | +Edit or remove an existing library configuration. |
| 87 | + |
| 88 | +. Open the *Library Configuration* page. |
| 89 | +. Select the configured library. |
| 90 | +. Use the available actions to update or delete the library. |
| 91 | ++ |
| 92 | +Deleting a library removes it from the project POM file and affects all components that use the library. |
0 commit comments