Skip to content

antd-java: examples can't be run via gradle — examples/ not registered as a subproject #71

@Nic-dorman

Description

@Nic-dorman

Bug

antd-java ships runnable example sources at examples/Example01Connect.java, Example02PublicData.java, etc., but they can't be invoked through the gradle wrapper:

$ cd antd-java
$ bash gradlew examples:build --no-daemon
FAILURE: Build failed with an exception.
* What went wrong:
Cannot locate tasks that match 'examples:build' as project 'examples' not found in root project 'antd-java'.

Cause

antd-java/settings.gradle.kts declares only the root project — no subprojects:

rootProject.name = "antd-java"

Compare antd-kotlin/settings.gradle.kts:

rootProject.name = "antd-kotlin"
include("lib")
include("examples")

So antd-kotlin registers the examples as a runnable subproject with its own application plugin and gradlew :examples:run --args=2 works. antd-java doesn't, and currently the only way to compile the example is by hand (javac -cp build/libs/antd-java-*.jar examples/*.java), assembling the right classpath manually.

Fix

Mirror the antd-kotlin layout:

  1. Move examples/Example*.java under examples/src/main/java/com/autonomi/examples/.
  2. Add examples/build.gradle.kts declaring the application plugin + mainClass.
  3. include("examples") in settings.gradle.kts.
  4. bash gradlew :examples:run -PmainClass=... or --args=... (one entry point per example, matching what antd-kotlin does with Main.kt).

This also gives parity across the JVM SDKs and unblocks the cross-SDK ant dev example dispatcher (see #65).

Pre-existing setup issue (separate ticket?)

Also relevant: antd-java/gradlew is committed without the executable bit; users must chmod +x gradlew before the wrapper will run. antd-kotlin/ is missing the wrapper script and gradle-wrapper.jar entirely (only gradle-wrapper.properties is checked in — see #69). Happy to file these as a single "JVM SDK packaging" issue if preferred.

Environment

  • JDK Temurin 17.0.19, gradle 9.4 (from wrapper)
  • antd-java at main

Found via cross-SDK e2e harness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions