Sharing Content Roots Should Be Allowed

I'm building an iOS Flash game with IntelliJ 12.1.3 that loads all it's assets at runtime (this is best practice). The assets folder is a source root containing hundreds of files and since I have 'copy resource files to output folder' checked, all my assets end up next to my SWF file, and I can access them at runtime. Great!

However, now I want to do a web version of my game, so I create a new web module, and add the assets folder as a source root, but wham! I get smacked with "two modules in a project cannot share the same content root".

Can someone please help me understand how modules should share assets that need to be copied to the output folder? I've tried setting up the assets as a Global Library, but with this approach, they wouldn't copy to the output folder - please help!

Thanks.

1 comment

Ok, did some reasearch and found the solution: artifacts (File | Project Structure | Artifacts)

1) Create a new Artifact of type 'Other'
2) Set the output directory to the bin folder of one of the modules that needs the assets
3) In the Output Layout tab, click the green plus icon and select "Directory Content" and pick the folder of assets you want to include
4) Repeat step 3 for every folder that needs to be outputed

Create a new Artitfact and repeat this process for every module that requires the assets. With this approach, the assets folders should not be on the source path of any of the modules.

1

Please sign in to leave a comment.