Skip to content

README's documented -Dexec.classpathScope=runtime fails for demos needing simple-xml (system-scoped dependency) #40

Description

@sqlparser

Summary

The root README documents one universal recipe for running any demo:

mvn -q exec:java -Dexec.mainClass=<package>.<Class> -Dexec.args="..." -Dexec.classpathScope=runtime

This fails with a NoClassDefFoundError for any demo that uses org.simpleframework.xml (e.g. dlineageBasic's Dlineage/DlineageRelation), because pom.xml declares that dependency with <scope>system</scope>, and Maven's runtime classpath scope does not include system-scoped dependencies — even though the jar is present at lib/simple-xml-2.7.1.jar.

Steps to reproduce

mvn package -DskipTests -q
cat > q.sql <<'SQL'
SELECT a.id, b.name FROM ta a JOIN tb b ON a.id = b.id WHERE a.x > 1;
SQL

mvn -q exec:java -Dexec.mainClass=demos.dlineageBasic.Dlineage \
    -Dexec.args="/f q.sql /t oracle" -Dexec.classpathScope=runtime

Actual output

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.1:java (default-cli) on project gsp_demo_java:
An exception occurred while executing the Java class. org/simpleframework/xml/Serializer: org.simpleframework.xml.Serializer

Workaround (not documented anywhere)

Using -Dexec.classpathScope=compile instead of runtime (everything else identical) works and produces correct <columnImpactResult> XML output.

Root cause

pom.xml:

<dependency>
    <groupId>org.simpleframework</groupId>
    <artifactId>simple-xml</artifactId>
    <version>2.7.1</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/simple-xml-2.7.1.jar</systemPath>
</dependency>

system-scoped dependencies are excluded from Maven's runtime classpath by design; only compile/provided/system scope resolution paths include them directly, and exec:java's runtime classpathScope maps to the runtime classpath.

Suggested fix

Either change the README's universal recipe to use -Dexec.classpathScope=compile (since it appears to work for every demo tested, not just the ones needing simple-xml), or migrate simple-xml off system scope onto a normal Maven Central coordinate/local repo install so it participates in runtime scope correctly.

Environment

  • OpenJDK 21.0.11, Apache Maven 3.8.7, Ubuntu 24.04.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions