Thomas,

Thank you for your reply.

What would be the "Maven way" to solve the problem where there is shared
test code framework/data across multiple subprojects?

For example Apache RAT has shared test data (used to verify
implementations) as well as helper classes for test cases (to assist in
correctly testing the subproject implementations)  The core tests need both
the shared data and the helper classes.  The helper classes need core
defined classes.

Is the maven way to create a separate module for code and test so that
test-fixtures can be inserted between the 2?

In your above comment are you saying that maven should not have bundled the
test processing into the main processing?

Thanks again.
Claude


On Sun, Jun 15, 2025 at 12:42 PM Thomas Broyer <t.bro...@gmail.com> wrote:

> Le dim. 15 juin 2025, 12:53, Claude Warren <cla...@xenei.com> a écrit :
>
> > I am trying to figure out how to structure a project so that the
> following
> > is possible.
> >
> > Logical structure
> >
> > core
> >   +-- main
> >   +-- test-fixtures
> >   +-- test (uses test-fixtures)
> >
> > tools
> >   +-- main (uses core)
> >   +-- test (uses test-fixtures)
> >
> > component1
> >   +-- main (uses tools to generate some code, uses core)
> >   +-- test (uses test-fixtures)
> >
> > component2
> >   +-- main (uses tools to generate some code, uses core)
> >   +-- test (uses test-fixtures)
> >
> > The problem I have is that I can not get the test-fixtures to be
> accessible
> > to the tools or components build when there is not already a jar built.
> >
> > Gradle has a solution where the core would be built, then the
> > text-fixtures, then the core test.  But there does not seem to be a way
> to
> > achieve the logical test-fixtures component.
> >
> > Does anyone have a suggestion for how to solve this problem?
> >
>
> Afaict you need to, either:
> - split test fixtures and core tests into separate projects
> - make sure you build the test fixtures jar early so it's available to the
> reactor build (but are running at least up to the package phase? "mvn test"
> is an anti-pattern in a multiproject build if you ask me); but this is not
> "the maven way"
> - maybe put test fixtures in src/test, and configure the test-jar to filter
> out non-fixtures classes (again, I'd say it's not "the maven way")
>
> >
>


-- 
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to