Question

I am having trouble bringing in a subrepository in my project. The idea is that I bring a module in /arbitrary/folder and I want to include it on my current project located at /important/project

When using the GUI Import Module... from the menu the actual folders are copied into my project subfolder. Given that both projects are in different repositories there is a maintenance problem as for every update the files need to be manually reimported and then committed to the main project. Mercurial also doesn't allow you to have subrepos at any depth bigger than root.

What is the correct approach to solve this problem?

Was it helpful?

Solution

You're right that the GUI for Import Module makes a copy instead of importing it in-place. Until that functionality is improved, you'll need to set it up by hand.

In your module being imported, make sure it has a build.gradle file that's properly set up to build the module. Then in your application's settings.gradle file, include it like this:

include ':some_module'
project(':some_module').projectDir = new File('/path/to/module')

Then you can depend on it from another module in the usual way, either by adding a dependency through the Project Structure UI or by adding this to the module:

dependencies {
    compile project(':some_module')
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top