Skip to content

Maven effective classpath is not honored #517

@eliasbalasis

Description

@eliasbalasis

The plugin seems to be including in the classpath of a DevMode run configuration, modules that are excluded by the Maven structure.

This includes dependencies in the test scope , dependencies marked "optional" and "exclusions"

The result is incompatible versions of classes, the ones excluded by the Maven structure, somehow being loaded first in the classpath causing runtime class loading and access errors.

The workaround I have used is repetition of the offending depedencies with their compatible versions at the beginning of the Maven POM of the module used to create the DevMode run configuration.

However, it is only a workaround requiring special handling and possibly frequent adjustments, making maintenance of projects not straightforward at all.

For example:
Imagine a shared library making use of some Spring Framework 2.6 modules but marking them "optional".
Then a real application makes use of the shared library but uses Spring Framework 7 instead.
It is modules of Spring Framework 2.6 somehow added first to the classpath of the DevMode run configuration even though it is excluded by the Maven structure, followed by some Spring Framework 7 modules.
This is very likely to cause problems at runtime, loading incompatible classes.

The problem is well known for many years but has recently become very intensive.
Would it be possible to consider an alternative method for building the classpath of the DevMode run configuration ? one that includes only the effective Maven dependencies.

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