Where are the Apigee java jars documented? What JARs are available, what versions of these jars exist, what functions do they perform, can I pull them in with a build script from somewhere like maven central?
The documentation for this seems to be lacking, and I dislike the cook book suggestion which just bundles the necessary dependencies in a lib folder within the project directory.
@robin wilkins , Welcome to Apigee Community.
See some what similar question here that lists available jars.
If anyone comes to answer this question, please help by including information about downloading the jars as well. Jars like message-flow and expression are not available in public repositories.
Yes, that's true. Unfortunate and true.
This is what I use to download and install those JARs into my local maven repo:
#!/bin/bash # -*- mode:shell-script; coding:utf-8; -*- # # Created: <Tue Oct 6 11:46:13 2015> # Last Updated: <2015-October-06 11:53:42> # echo echo "This script downloads JAR files and installs them into the local Maven repo." echo curl -O https://raw.githubusercontent.com/apigee/api-platform-samples/master/doc-samples/java-cookbook/lib/e... mvn install:install-file \ -Dfile=expressions-1.0.0.jar \ -DgroupId=com.apigee.edge \ -DartifactId=expressions \ -Dversion=1.0.0 \ -Dpackaging=jar \ -DgeneratePom=true rm expressions-1.0.0.jar curl -O https://raw.githubusercontent.com/apigee/api-platform-samples/master/doc-samples/java-cookbook/lib/m... mvn install:install-file \ -Dfile=message-flow-1.0.0.jar \ -DgroupId=com.apigee.edge \ -DartifactId=message-flow \ -Dversion=1.0.0 \ -Dpackaging=jar \ -DgeneratePom=true rm message-flow-1.0.0.jar echo echo done. echo
The above is no longer the current answer.
The JARs are available in a proper repo. For a maven build, Set your pom.xml like this:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.apigee.callouts</groupId>
<artifactId>apigee-custom-policy</artifactId>
<version>20240815</version>
<name>MyApigeeJavaCustomPolicy</name>
<url>http://maven.apache.org</url>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<apigee.expressions.version>1.0.0</apigee.expressions.version>
<apigee.message.flow.version>1.0.0</apigee.message.flow.version>
...
</properties>
<repositories>
<!-- repo for Apigee JARs -->
<repository>
<id>artifact-registry</id>
<url>https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.apigee.gateway.libraries</groupId>
<artifactId>message-flow</artifactId>
<version>${apigee.message.flow.version}</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.apigee.infra.libraries</groupId>
<artifactId>expressions</artifactId>
<version>${apigee.expressions.version}</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
...
Working example here: https://github.com/DinoChiesa/ApigeeEdge-JavaCallout101
The repo url displays 404 error, and I can't find a working repo at the moment. Any clue?
I'd say:
Don't depend on stuff that isn't documented. If Apigee docs don't list a set of JARs you can depend on, then there is no set of jars you can depend on.
Also, I'd say, that's not quite strictly true. In my experience, Apigee uses BouncyCastle (a current version), so right now anyway, you don't need to bundle that one. I am unsure about other JARs. Of course, Apigee may change that behavior since it's undocumented....
You may want to check out some of the example Java callouts I have published on my github repo.
Go here and search for "Java", and you'll see a bunch of Apigee callouts with maven pom.xml configuration that will show you how to be successful.