Raptor Dzuricsko
Raptor Dzuricsko

Reputation: 63

legacy project structure: intellij recognizes gradle subproject as module but doesn't recognize its source code

Sorry for the long title.

I'm trying to isolate our functional test code from our integration test code, and have gotten it to work using gradle tasks. It's 95% working in intellij, too, except that every time I do a "gradle idea", i have to add the functional test code.

It's currently not an option to separate it into its own repository or change the directory structure.

The directory structure looks like

* MainProject/build.gradle
* MainProject/WEB-INF/src(java source code)
* MainProject/(lots of html files)
* MainProject/WEB-INF/functionalTest(groovy source code)
* MainProject/functional-gradle/build.gradle

and I want intellij to automatically detect that the functionalTest test source code belongs to functional-gradle, even though it looks like it should be a part of MainProject(but is not included in any of the MainProject build.gradle sourceSets).

Other considerations : I would like it to be a gradle subproject and not part of the main build.gradle as a different sourceset because our current build process isn't very standard, and it'd be nice to start with a clean gradle slate and isolate the gradle tasks that are needed for the functional tasks(there are a lot of them). This would make it easier to eventually pull out into its own repository.

The picture below shows the intellij field i want to be auto-populated : the sub project module's test source folder.

intellij subproject

the important part of the gradle sutff

sourceSets {
    test{
        groovy{
            srcDir '../WEB-INF/catTest'}
    }
}

Upvotes: 2

Views: 307

Answers (1)

Raptor Dzuricsko
Raptor Dzuricsko

Reputation: 63

Getting Intellij IDEA (13+) to recognize Gradle module interdependencies

I looked at Radim's answer and it looks like there's gradle docs on how to set up the ide's IML file. https://docs.gradle.org/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html

Going to play around with that and will report back once I've got something working for my use case.

EDIT: I gave up and moved the build.gradle from the external folder on the root to inside the functional testing directory. Intellij picked this up right away.

Upvotes: 2

Related Questions