Skip to content

Dependency Management in Martini

Martini provides a streamlined approach to manage external dependencies for your packages through the dependency.xml file located in the <package-name>\configuration\ folder. This XML file allows you to define and organize the libraries and components your package relies on, ensuring smooth integration and functionality.

Structure of dependency.xml

The dependency.xml file follows a specific structure that allows you to declare dependencies for your package effectively. Below is an example of its contents:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<martini-package>
  <package>
    <dependencies/>
  </package>
  <jar>
    <dependencies/>
  </jar>
  <repositoryConfig>
    <enableMarketplaceRepository>true</enableMarketplaceRepository>
    <repositories/>
  </repositoryConfig>
</martini-package>

Key Components

  1. <package>: This section is where you can define the Package dependencies for your specific Package. List all the other Packages that your Package requires to function properly within this tag.

  2. <jar>: Similar to the ackage section, this area is dedicated to declaring any JAR files that your package depends on. This helps in managing JAR dependencies separately from package dependencies.

  3. <repositoryConfig>: This section configures repository settings for your package.

    • <enableMarketplaceRepository>: Setting this to true allows your package to access the marketplace repository, enabling the discovery and use of additional dependencies from the marketplace.
    • <repositories>: Here, you can define custom repositories that your package can access to resolve its dependencies.

Managing Dependencies

To manage your package dependencies effectively, follow these best practices:

1
2
3
- **Keep Dependencies Updated**: Regularly check for updates to external libraries and JAR files to ensure your package benefits from the latest features and security fixes.
- **Minimize Dependency Size**: Only include the necessary dependencies to keep your package lightweight and efficient.
- **Document Dependencies**: Maintain clear documentation on the purpose of each dependency to facilitate easier maintenance and understanding for future developers.