Idea modules containing itself as dependencies


(AdrianTodt) #1

Hi,

I’m using a Grade Project to rule a multiple module project on IntelliJ, but it’s generating an .iml containing itself as dependency.

My Gradle settings:
/settings.gradle:

rootProject.name = 'PyxelMyst'
include 'api', 'api-impl', 'common', 'client', 'server', 'desktop', 'desktop-client', 'desktop-server', 'android-client'

root build.gradle:

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
		classpath 'org.codehaus.groovy:groovy-android-gradle-plugin:1.1.0'
    }
}

allprojects {
    version = '1.0'

    ext {
        appName = "PyxelMyst"
        gdxVersion = '1.9.5'
        aiVersion = '1.8.0'
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

each module’s build.gradle:

apply plugin: "groovy"

sourceCompatibility = 1.7

dependencies {
	compile project(":common") //and/or other modules required
	compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion" //or other GDX required dependency
}

compileGroovy.options.encoding = 'UTF-8'

jar.baseName = rootProject.name + "-" + project.name

And all projects generate a project.iml like:

<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":client" ...>
    ...
    <orderEntry type="library" exported="" name="client.PyxelMyst-client-1.0" level="project" />
  </component>
</module>

with that last orderEntry containing the library built by the module/project itself. This causes IntelliJ to comply that the project “already have every single class”, but this is not because I can build all projects without problem.

Is there a way to either remove the IntelliJ’s fake self-dependency? I already spent 4 hours trying to fix this and I can’t get it to work.

All projects only have apply plugin: "groovy" with exception of the Android Project. Also I didn’t edited the Project Structure of IntelliJ. And all build.gradles are based on the one that I sent and all .imls have self-dependency.
Also, I have sure that the modules doesn’t create a cyclic dependency and I’m not using a idea plugin to generate the .imls., just the regular IntelliJ Gradle support. Also, the Android and Desktop-Client/Server modules (The ones I deploy) don’t generate the self-dependency, but the other project does.

Thanks in Advice,

Adrian


(Eric Siebeneich) #2

Did you ever find the solution to this? I am having the exact same problem.

Interesting that I am also using libgdx. I wonder if that has something to do with it.


(Stefan Oehme) #3

A reproducible example project would greatly increase the chances of finding/fixing the issue.