ArchUnit icon indicating copy to clipboard operation
ArchUnit copied to clipboard

Tests fail when using non-default "target" folder

Open heyarny opened this issue 1 year ago • 1 comments

It seems like all tests & validations are only working when using the default "target" maven folder. As soon you change the target to something else, you get unwanted errors, because many packages and other settings match the tests itself.

Please add an option to define the target folder via maven config or even better: use ${project.build.directory} instead.

heyarny avatar Jul 15 '24 11:07 heyarny

Can you give an example of what you mean? Or better a small project to reproduce this? Principally ArchUnit usually just reads classes from the classpath, so it doesn't matter in which folder your classes reside, as long as the ClassLoader can find them.

If you refer to the predefined ImportOption DoNotIncludeTests (which indeed depends on a couple of default folders), then that's a known limitation. It's meant for the 99.999% of default cases where we can just assume a standard build tool layout. If you've reconfigured that, then you just need to create a custom ImportOption (you can peek into DoNotIncludeTests to copy & paste).

codecholeric avatar Jul 27 '24 19:07 codecholeric

Gonna close this for now, feel free to reopen if you want to pick this up again!

codecholeric avatar Nov 10 '24 10:11 codecholeric