Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

where to get the most recent JAR libraries for Java Callout?

Hi there,

For reasons that I cannot challenge (at the moment) we are required to perform AES decryption on Apigee, as such and given the Javascript crypto object is limited we have built a Java Callout which is working as we speak.

However, we had few challenges to get the dependent libraries to be downloaded.

At the moment, the latest message-flow 1.0.0 was obtained successfully from https://repository.apigee.com/repository/public-repo/

But expressions 1.0.0 is not available on the same repository.

The way we manage to get this working was to use expressions from the api-platform-samples-master, but it contains an old version of the binaries which were built for JDK 6.  Which makes us a bit sceptical of getting this compiled code live knowing this is not ideal.

Also after bit more digging we found these JAR files would also reside on the installed environment, however although it is an OPDK installation we don't have permissions to access the filesystem in order to download the JAR files.

What is weird is that message-flow is available on apigee maven repositories but not expressions. What are we missing here? Can someone help please?

 

 

 

 

Solved Solved
0 8 577
2 ACCEPTED SOLUTIONS

Thanks for that

I must have a pre-populated .m2 cache. 

 

Let me raise a bug.  internal ref: b/370985586

View solution in original post

Can you try something for me? 

Can you try removing the specific directory for com.apigee in your .m2 local cache, and then re-try that operation?  I just tried it here and it seems to work fine.  

rm -fr ~/.m2/repository/com/apigee

mvn dependency:get -Dartifact=com.apigee.infra.libraries:expressions:1.0.0 \
   -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/

mvn dependency:get -Dartifact=com.apigee.gateway.libraries:message-flow:1.0.0 \
    -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/

This worked for me.  I searched around and found this suggestion on Stackoverflow .

I guess it's possible there was something that changed between when I tried this originally and now.  

View solution in original post

8 REPLIES 8

I think this can be closed, after more digging, could find the following curl on the "buildsetup.sh" script

curl "https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/gateway/libraries/message-flow/1.0.0/message-flow-1.0.0.jar" -v -L -o message-flow-1.0.0.jar

curl "https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar" -v -L -o expressions-1.0.0.jar

ok. Glad you solved it. 

sorry about the confusion

We're in the process of updating the documentation on this.

In the future, to take advantage of Maven automatically downloading the jars, you can use a POM file like this: 

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.google.apigee</groupId>
  <artifactId>apigee-callout-awsv4sig</artifactId>
  <version>20240919</version>
  <name>ApigeeAwsV4Sig</name>
  <url>http://maven.apache.org</url>
  <packaging>jar</packaging>

  <properties>
    <jdk.target.version>11</jdk.target.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    ...
  </properties>

  <repositories>
    <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>1.0.0</version>
      <scope>provided</scope>
      <type>jar</type>
    </dependency>

    <dependency>
      <groupId>com.apigee.infra.libraries</groupId>
      <artifactId>expressions</artifactId>
      <version>1.0.0</version>
      <scope>provided</scope>
      <type>jar</type>
    </dependency>
    ... 

 

what is stranger on all this is why directly curl works but not mvn dependency:get

gives the impression that some mvn metadata is not available for expressions library

 

$ mvn dependency:get -Dartifact=com.apigee.gateway.libraries:message-flow:1.0.0 -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- dependency:3.7.0:get (default-cli) @ standalone-pom ---
[INFO] Resolving com.apigee.gateway.libraries:message-flow:jar:1.0.0 with transitive dependencies
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.116 s
[INFO] Finished at: 2024-10-02T08:46:34+01:00
[INFO] ------------------------------------------------------------------------


$ mvn dependency:get -Dartifact=com.apigee.infra.libraries:expressions:1.0.0 -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- dependency:3.7.0:get (default-cli) @ standalone-pom ---
[INFO] Resolving com.apigee.infra.libraries:expressions:jar:1.0.0 with transitive dependencies
[WARNING] The POM for com.apigee.infra.libraries:expressions:jar:1.0.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model
[FATAL] Non-parseable POM <<<<removed>>>>\.m2\repository\com\apigee\infra\libraries\expressions\1.0.0\expressions-1.0.0.pom: unexpected markup <!d (position: START_DOCUMENT seen <!d... @1:4)  @ line 1, column 4

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.147 s
[INFO] Finished at: 2024-10-02T08:46:46+01:00
[INFO] ------------------------------------------------------------------------

$ cat "<<<<removed>>>>\.m2\repository\com\apigee\infra\libraries\expressions\1.0.0\expressions-1.0.0.pom"
<!doctype html>
<html>
<head>
    <title>Apigee</title>
    <link rel="shortcut icon" type="image/x-icon" href="/static-assets/favicon.ico" sizes="64x64">
    <link rel="preload" href="/static/v2.3.4/apigee.css" as="style">
    <link rel="stylesheet" href="/static-assets/static.css?v=1.3.1">
    <script>
        dataLayer = [{'webapp.name': 'static'}];
    </script>
</head>
<body>
    <!-- Google Tag Manager -->
    <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-N52333" height="0" width="0" style="display:none;visibility:hidden"></iframe>
    </noscript>
    <script>
        (function (w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime(),
                event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src='//www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', 'GTM-N52333');
    </script>
    <!-- End Google Tag Manager -->

    <main class="app-view">
        <article class="static-content">
            <div class="apigee-logo"></div>
            <div class="static-content-title">Error: 404</div>
            <div class="static-content-text">
                Sorry, the page you're looking for can't be found. <br/> Try checking the URL for errors? <br/> Keep getting this page? Report this to our support team.
            </div>

            <button class="alm-button-action-filled" onclick="location.href='/'">Go to home page</button>
        </article>
    </main>
</body>
</html>

 

@dchiesa1 by the way thanks for replying.

On another note I saved the pom you shared and did a mvn dependency:resolve and I am getting same issue, i.e. expressions is just a simple HTML reply whereas message-flow is obtained successfully.

$ mvn dependency:resolve
[INFO] Scanning for projects...
[INFO]
[INFO] -------------< com.google.apigee:apigee-callout-awsv4sig >--------------
[INFO] Building ApigeeAwsV4Sig 20240919
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Artifact com.apigee.infra.libraries:expressions:pom:1.0.0 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [artifact-registry (https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[INFO] Artifact com.apigee.infra.libraries:expressions:pom:1.0.0 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [artifact-registry (https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
Downloading from artifact-registry: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.pom
Downloaded from artifact-registry: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.pom (0 B at 0 B/s)
[WARNING] The POM for com.apigee.infra.libraries:expressions:jar:1.0.0 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model
[FATAL] Non-parseable POM <<<removed>>>\.m2\repository\com\apigee\infra\libraries\expressions\1.0.0\expressions-1.0.0.pom: unexpected markup <!d (position: START_DOCUMENT seen <!d... @1:4)  @ line 1, column 4

[INFO] Artifact com.apigee.infra.libraries:expressions:jar:1.0.0 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [artifact-registry (https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[INFO] Artifact com.apigee.infra.libraries:expressions:jar:1.0.0 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [artifact-registry (https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
Downloading from artifact-registry: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar
Downloaded from artifact-registry: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar (0 B at 0 B/s)
[INFO]
[INFO] --- dependency:3.7.0:resolve (default-cli) @ apigee-callout-awsv4sig ---
[INFO] Can't extract module name from expressions-1.0.0.jar: zip END header not found
[INFO]
[INFO] The following files have been resolved:
[INFO]    com.apigee.gateway.libraries:message-flow:jar:1.0.0:provided -- module message.flow (auto)
[INFO]    com.apigee.infra.libraries:expressions:jar:1.0.0:provided
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.762 s
[INFO] Finished at: 2024-10-02T08:56:38+01:00
[INFO] ------------------------------------------------------------------------

 

Thanks for that

I must have a pre-populated .m2 cache. 

 

Let me raise a bug.  internal ref: b/370985586

Can you try something for me? 

Can you try removing the specific directory for com.apigee in your .m2 local cache, and then re-try that operation?  I just tried it here and it seems to work fine.  

rm -fr ~/.m2/repository/com/apigee

mvn dependency:get -Dartifact=com.apigee.infra.libraries:expressions:1.0.0 \
   -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/

mvn dependency:get -Dartifact=com.apigee.gateway.libraries:message-flow:1.0.0 \
    -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/

This worked for me.  I searched around and found this suggestion on Stackoverflow .

I guess it's possible there was something that changed between when I tried this originally and now.  

That seems to have resolved the issue. Strange but maybe a local maven cache got corrupted?

(remove) MINGW64 /
$ rm -rf "(remove)\.m2\repository\com\apigee"

(remove) MINGW64 /
$ dir "(remove)\.m2\repository\com\apigee"
dir: cannot access '(remove)\.m2\repository\com\apigee': No such file or directory

(remove) MINGW64 /
$ mvn dependency:get -Dartifact=com.apigee.infra.libraries:expressions:1.0.0 -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- dependency:3.7.0:get (default-cli) @ standalone-pom ---
[INFO] Resolving com.apigee.infra.libraries:expressions:jar:1.0.0 with transitive dependencies
Downloading from central: https://repo.maven.apache.org/maven2/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.pom
Downloading from temp: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.pom
Downloaded from temp: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.pom (2.1 kB at 957 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-maven-wagon/2.2.1/artifactregistry-maven-wagon-2.2.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-maven-wagon/2.2.1/artifactregistry-maven-wagon-2.2.1.pom (6.8 kB at 108 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-auth-common/2.2.1/artifactregistry-auth-common-2.2.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-auth-common/2.2.1/artifactregistry-auth-common-2.2.1.pom (7.8 kB at 138 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-maven-wagon/2.2.1/artifactregistry-maven-wagon-2.2.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-auth-common/2.2.1/artifactregistry-auth-common-2.2.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-auth-common/2.2.1/artifactregistry-auth-common-2.2.1.jar (6.2 kB at 113 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/artifactregistry/artifactregistry-maven-wagon/2.2.1/artifactregistry-maven-wagon-2.2.1.jar (8.7 kB at 59 kB/s)
Downloading from temp: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar
Downloaded from temp: https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/com/apigee/infra/libraries/expressions/1.0.0/expressions-1.0.0.jar (40 kB at 24 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.969 s
[INFO] Finished at: 2024-10-07T11:47:20+01:00
[INFO] ------------------------------------------------------------------------

(remove) MINGW64 /
$ mvn dependency:get -Dartifact=com.apigee.infra.libraries:expressions:1.0.0 -DremoteRepositories=https://us-maven.pkg.dev/apigee-release/apigee-java-callout-dependencies/
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- dependency:3.7.0:get (default-cli) @ standalone-pom ---
[INFO] Resolving com.apigee.infra.libraries:expressions:jar:1.0.0 with transitive dependencies
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.360 s
[INFO] Finished at: 2024-10-07T11:47:27+01:00
[INFO] ------------------------------------------------------------------------

 

great to hear! 

Thanks for the followup.