This is an automated email from the ASF dual-hosted git repository.
sxnan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
The following commit(s) were added to refs/heads/main by this push:
new e2240cd [Feature] Support multiple jdk versions (#413)
e2240cd is described below
commit e2240cd87a2b19e4275b010483a91782061d78d2
Author: Xuannan <[email protected]>
AuthorDate: Thu Jan 8 14:31:26 2026 +0800
[Feature] Support multiple jdk versions (#413)
---
api/pom.xml | 31 +++++++++++++++++++++++++++
dist/flink-1.20/pom.xml | 18 +++-------------
docs/content/docs/development/tool_use.md | 2 +-
docs/content/docs/get-started/installation.md | 13 ++++++++++-
integrations/mcp/pom.xml | 5 +++++
pom.xml | 14 +-----------
tools/releasing/deploy_staging_jars.sh | 31 ++++++++++++++++++++++++++-
7 files changed, 83 insertions(+), 31 deletions(-)
diff --git a/api/pom.xml b/api/pom.xml
index 6d5cafa..c49ab13 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -84,6 +84,37 @@ under the License.
</plugins>
</build>
</profile>
+
+ <!-- Profile for generating jdk11 classifier jar (excludes MCPServer)
-->
+ <profile>
+ <id>java-11-target</id>
+ <activation>
+ <property>
+ <name>java-11-target</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <!-- Default is already Java 11, no need to set
source/target -->
+ <excludes>
+
<exclude>org/apache/flink/agents/api/annotation/MCPServer.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>jdk11</classifier>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/dist/flink-1.20/pom.xml b/dist/flink-1.20/pom.xml
index bf465a5..fe4fc4f 100644
--- a/dist/flink-1.20/pom.xml
+++ b/dist/flink-1.20/pom.xml
@@ -138,28 +138,16 @@ under the License.
</executions>
</plugin>
- <!-- Override parent's shade plugin -->
+ <!-- Extend parent's shade plugin with flink-1.20 specific
exclusions -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade-flink-agents</id>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
<configuration>
- <shadeTestJar>false</shadeTestJar>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>META-INF/*.SF</exclude>
- <exclude>META-INF/*.DSA</exclude>
- <exclude>META-INF/*.RSA</exclude>
- </excludes>
- </filter>
+ <!-- Append flink-1.20 specific filter to parent's
filters -->
+ <filters combine.children="append">
<!-- Exclude the conflict classes of the
runtime module, using version flink-1.20. -->
<filter>
<artifact>org.apache.flink:flink-agents-runtime</artifact>
diff --git a/docs/content/docs/development/tool_use.md
b/docs/content/docs/development/tool_use.md
index 11f1fb4..5d8f994 100644
--- a/docs/content/docs/development/tool_use.md
+++ b/docs/content/docs/development/tool_use.md
@@ -186,7 +186,7 @@ MCP (Model Context Protocol) is a standardized protocol for
integrating AI appli
{{< /hint >}}
{{< hint warning >}}
-MCP Tool is only supported in python currently.
+**JDK Requirement (Java API only):** If you are using the **Java API** to
develop Flink Agents jobs with MCP, you need **JDK 17 or higher**. This
requirement does not apply to **Python API** users - the Python SDK has its own
MCP implementation and works with JDK 11+.
{{< /hint >}}
MCP tools are managed by external MCP servers and automatically discovered
when you define an MCP server connection in your agent.
diff --git a/docs/content/docs/get-started/installation.md
b/docs/content/docs/get-started/installation.md
index b1a8686..f6f0154 100644
--- a/docs/content/docs/get-started/installation.md
+++ b/docs/content/docs/get-started/installation.md
@@ -64,7 +64,18 @@ cp $FLINK_HOME/opt/flink-python-1.20.3.jar $FLINK_HOME/lib/
- Unix-like environment (Linux, Mac OS X, Cygwin, or WSL)
- Git
- Maven 3
- - Java 11
+ - Java 17+ (full functionality), or Java 11+ (some features unavailable)
+
+### Java Versions
+
+For running an agent built with **Python API**, you can use any Java version
11 or higher.
+
+When using **Java API**, there are some functionality limitations for earlier
Java versions, as detailed below:
+
+| Java Version | Limitations |
+|--------------|-------------------------------|
+| Java 17+ | No limitations. |
+| Java 11-16 | MCP supports are unavailable. |
### Set Up Python Environment (Recommended)
diff --git a/integrations/mcp/pom.xml b/integrations/mcp/pom.xml
index e5c917f..31118e2 100644
--- a/integrations/mcp/pom.xml
+++ b/integrations/mcp/pom.xml
@@ -49,6 +49,11 @@ under the License.
<activation>
<jdk>[17,)</jdk>
</activation>
+ <properties>
+ <target.java.version>17</target.java.version>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
+ </properties>
<dependencies>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
diff --git a/pom.xml b/pom.xml
index c7df352..6a80955 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,7 +36,7 @@ under the License.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <target.java.version>17</target.java.version>
+ <target.java.version>11</target.java.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
<spotless.version>2.27.1</spotless.version>
@@ -111,18 +111,6 @@ under the License.
</properties>
</profile>
- <profile>
- <id>java-17</id>
- <activation>
- <jdk>[17,)</jdk>
- </activation>
- <properties>
- <target.java.version>17</target.java.version>
- <maven.compiler.source>17</maven.compiler.source>
- <maven.compiler.target>17</maven.compiler.target>
- </properties>
- </profile>
-
<profile>
<id>release</id>
<activation>
diff --git a/tools/releasing/deploy_staging_jars.sh
b/tools/releasing/deploy_staging_jars.sh
index e076869..d288f91 100755
--- a/tools/releasing/deploy_staging_jars.sh
+++ b/tools/releasing/deploy_staging_jars.sh
@@ -35,12 +35,41 @@ if [[ `basename $CURR_DIR` != "tools" ]] ; then
exit 1
fi
+# Check JDK version - must be JDK 17
+JAVA_VERSION=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1)
+if [[ "$JAVA_VERSION" != "17" ]]; then
+ echo "Error: JDK 17 is required for release. Current version: $(java
-version 2>&1 | head -1)"
+ exit 1
+fi
+
###########################
cd ..
-echo "Deploying to repository.apache.org"
+echo "=== Flink Agents Multi-JDK Release ==="
+echo "Using Java: $(java -version 2>&1 | head -1)"
COMMON_OPTIONS="-Prelease,docs-and-source -DskipTests
-DretryFailedDeploymentCount=10 $CUSTOM_OPTIONS"
+###########################
+# Phase 1: Build and deploy default version (JDK 17)
+###########################
+
+echo ""
+echo "=== Phase 1: Building and deploying default version (JDK 17 bytecode)
==="
+echo ""
+
$MVN clean deploy $COMMON_OPTIONS
+
+###########################
+# Phase 2: Build and deploy api module with jdk11 classifier
+###########################
+
+echo ""
+echo "=== Phase 2: Building and deploying flink-agents-api with jdk11
classifier (JDK 11 bytecode) ==="
+echo ""
+
+$MVN deploy -pl api -Pjava-11-target $COMMON_OPTIONS
+
+echo ""
+echo "=== Release complete: Both default (JDK 17) and jdk11 classifier
versions deployed ==="