Managing dependencies

For advanced APIs, you would probably need to use some external libraries or to use other services. This can be done by adding dependencies to your API.

In xins-projects.xml you can add an attribute dependenciesdir to indicate in which directory the jar files used by your project will be included. For example

<project name="myprojects"
         rcsversion="$Revision: 1.102 $" rcsdate="$Date: 2013/01/02 17:28:58 $"
         dependenciesdir="../other-projects"
         domain="com.mycompany">
</project>

In apis\<api>\impl\impl.xml you add the jar files needed for your project using the dependency element. For example

<impl>
  <dependency dir="utils" />
  <dependency dir="capis" includes="project2-capi.jar" />
  <dependency dir="spring" includes="spring.jar" deploy="false" />
</impl>

In the previous example when your implementation will be compiled the following jar files will be in the classpath: ..\other-projects\utils\*.jar;..\other-projects\capis\project2-capi.jar;..\other-projects\xins\xins-client.jar. These files will also be included in the generated WAR file except for spring.jar. This deploy attribute has been introduced in XINS 2.2.

An example of dependencies is provided in XINS with the filteredproject demo. This API calls another API (myproject) using CAPI.

Note

The order of the elements in the imp.xml is important, if the elements are not in the correct order the validation of impl.xml with the DTD will fail.

The order is logdoc, bootstrap-properties, runtime-properties, content, dependency, calling-convention, instance.