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

Receive FileAlreadyExistsException with multi-module-projects structure #1013

Open
tanyagorn opened this issue Nov 17, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@tanyagorn
Copy link

Summary

I know that to run stryker on multi-module-projects, I need to use command sbt project projectName; stryker to run each module separately. However I have a repository with structure like this ...

sbt-multi-project-example/
    - common/
        - src/
             - main/
             - test/
    - multi1/
        - src/
             - main/
             - test/
    - multi2/
        - src/
            - main/
            - test/
    - project/
        - build.properties
        - plugins.sbt
    - src/
        - main/
        - test/
    - build.sbt

common, multi1, multi2 are sub-modules project in which I can run stryker with command like sbt project common; stryker without any problem.
However, my goal is to run stryker on src directory. Please notice that it doesn't have parent directory like others, so to run stryker on it I use command like sbt stryker but Stryker always give me this error

sbt:sbt-multi-project-example> stryker
[info] Attempting to read config from stryker4s.conf
[info] Found 1 file(s) to be mutated.
[info] 2 Mutant(s) generated.()
[info] Setting up mutated environment...
[error] stack trace is suppressed; run last stryker for the full output
[error] (stryker) fs2.CompositeFailure: Multiple exceptions were thrown (2), first java.nio.file.FileAlreadyExistsException: /Users/tbenjaprompa/Documents/GitHub/sbt-multi-project-example/common/target/src/main/scala/Model.scala
[error] Total time: 2 s, completed Nov 17, 2021 7:30:56 PM

You can checkout my repository to try out here https://github.com/tanyagorn/sbt-multi-project-example
I know that the structure is kinda weird... but I have multiple project with structure like this and it give me a headache. Any suggestion or is it possible to run stryker on this?

Stryker4s config

stryker4s {
    base-dir: "."
    mutate: [
        "src/main/scala/*.scala"
    ]
}

Stryker4s environment

stryker4s 0.14.1

Your Environment

software version(s)
Scala version 2.12.3
Build tool & version Intellij Idea community 2021.1.3 (community edition)
Operating System macOS
@hugo-vrijswijk
Copy link
Member

Hi! Thanks for creating this issue. I think this is a bug in Stryker4s. I can reproduce the example repo. Removing base-dir: "." from the config fixes the exception thrown. The current working directory is already the default when running Stryker4s and leaving base-dir empty.

I'll look into why this is thrown. I'm not certain if it is related to your original issue on your project

@hugo-vrijswijk hugo-vrijswijk added the bug Something isn't working label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants