I'm trying out Dagger2 in Intellij 2016.1 (but not with gradle) on ubuntu.
Intellij creates dagger's generated sources in either
./out/production/<ProjectModule>/generated/
or
./out/test/<ProjectModule>/generated_tests/
depending on if it was generated from a source or test directory, respectively.
But from what I tell, I can only mark those directories as either sources root
, test sources root
, or generated sources root
; there is no option for generated test sources root
, say.
Why is this important? Because the generated test sources depend on my test sources. If they are marked as a generated sources root
then Intellij cannot find the dependencies.
Note: I don't think they should be marked as test sources root
because then Intellij tries to compile those again; unless there is some way of preventing this of which I am unaware.
So is there a way to mark this directory as a generated test sources root
or something equivalent?
From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Project Settings | Modules. Select the necessary module and then open the Sources tab in the right-hand part of the dialog. Click Add Content Root and specify the folder that you want to add as a new content root.
To mark a diectory as "generated test sources root", open the "Project Structure" dialog at Project Settings > Modules and click on the little "P" next to your folder of choice, and select the "For generated resources" button.
In the Project tool window ( Alt+1 ), right-click the node in which you want to create a new directory and select New | Directory. Alternatively, select the node, press Alt+Insert , and click Directory. Name the new directory and press Enter .
To mark a diectory as "generated test sources root", open the "Project Structure" dialog at Project Settings > Modules and click on the little "P" next to your folder of choice, and select the "For generated resources" button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With