Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTELLIJ_TEST_PATTERN doesn't work with multi module projects #696

Closed
JCook21 opened this issue Oct 19, 2021 · 3 comments · Fixed by #820
Closed

INTELLIJ_TEST_PATTERN doesn't work with multi module projects #696

JCook21 opened this issue Oct 19, 2021 · 3 comments · Fixed by #820

Comments

@JCook21
Copy link

JCook21 commented Oct 19, 2021

Firstly, thanks for creating this library. It's an awesome and very useful tool.

I've come across a small issue when trying to exclude test classes when importing classes. It seems that the IntelliJ test pattern in ImportOption.java doesn't work with multi-module projects. In the project I work in I had to use .*/out/test/.* to exclude test classes properly. Would be possible to look into this and possibly expand the pattern to support multi module projects?

@codecholeric
Copy link
Collaborator

Hmm, but usually all classes are compiled into .*/out/test/classes/.*, no? So far that pattern seems to have worked okay 🤔 Can you provide an example to what path your classes are compiled to that is not matched by this pattern, but by .*/out/test/.*?

@JCook21
Copy link
Author

JCook21 commented Feb 21, 2022

I'm not sure if this is project specific but what I'm seeing in the multi module project I'm working in is that classes are being written to a path consisting of the module name, with a sub path consisting of the package name. E.g. if the module was called 'foo' and the package was 'com.foo.bar' I'd see this path: out/test/foo/com/foo/bar/class_name.class. This may be highly specific to the project I work in but I wonder if .*/out/test/classes/.* may be a little too generic.

@codecholeric
Copy link
Collaborator

Okay, I played around a little bit and I can reproduce it with a plain IntelliJ project without any build tool 🤔 Then it seems to create a subfolder with the method name... I guess we could just adjust the pattern to .*/out/test/.* then as you did, since in the end everything inside of .*/out/test/.* can be considered test scope 🤷‍♂️

JCook21 added a commit to JCook21/ArchUnit that referenced this issue Mar 1, 2022
JCook21 added a commit to JCook21/ArchUnit that referenced this issue Mar 1, 2022
…with multi-module projects. Issue TNG#696

Signed-off-by: Cook, Jeremy <[email protected]>
codecholeric pushed a commit to JCook21/ArchUnit that referenced this issue Mar 2, 2022
Plain IntelliJ projects (i.e. set up without any build tool) now seem to use the pattern `out/test/$MODULE_NAME` to compile class files to. Since we can safely assume that everything built into `out/test` belongs to the test scope, we can adjust the IntelliJ pattern to exclude everything in `.*/out/test/.*` to catch all cases, no matter if set up with a build tool or directly with IntelliJ.

Issue: TNG#696

Signed-off-by: Cook, Jeremy <[email protected]>
codecholeric pushed a commit to JCook21/ArchUnit that referenced this issue Mar 2, 2022
Plain IntelliJ projects (i.e. set up without any build tool) now seem to use the pattern `out/test/$MODULE_NAME` to compile class files to. Since we can safely assume that everything built into `out/test` belongs to the test scope, we can adjust the IntelliJ pattern to exclude everything in `.*/out/test/.*` to catch all cases, no matter if set up with a build tool or directly with IntelliJ.

Issue: TNG#696

Signed-off-by: Cook, Jeremy <[email protected]>
codecholeric pushed a commit to marknp/ArchUnit that referenced this issue Apr 10, 2022
Plain IntelliJ projects (i.e. set up without any build tool) now seem to use the pattern `out/test/$MODULE_NAME` to compile class files to. Since we can safely assume that everything built into `out/test` belongs to the test scope, we can adjust the IntelliJ pattern to exclude everything in `.*/out/test/.*` to catch all cases, no matter if set up with a build tool or directly with IntelliJ.

Issue: TNG#696

Signed-off-by: Cook, Jeremy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants