2

I use gradle with eclipse and have a local jar and its source jar:

I include the local jar as:

dependencies {
  compile name: 'mgwt-2.0.1-SNAPSHOT'
}

I have also the local source jar of this local jar: mgwt-2.0.1-SNAPSHOT:sources.

How can I include this such that eclipse can read the code?

confile
  • 30,949
  • 47
  • 199
  • 357
  • eclipse > your project > build path > libraries > your jar > expand > source attachement > edit ... or [here](http://stackoverflow.com/questions/122160/is-there-an-easy-way-to-attach-source-in-eclipse) – guleryuz Jan 03 '16 at 07:35

1 Answers1

0

We got this to work by defining a local repository for those jars:

allprojects {
    repositories {
        flatDir name: 'localRepo', dirs: [new File("theDirectory").absolutePath]
    }
}

The directory theDirectory contains jar files complying to Maven naming conventions:

mgwt-2.0.1-SNAPSHOT.jar
mgwt-2.0.1-SNAPSHOT-sources.jar

We refer to these jar files by omitting the groupId as follows:

dependencies {
    compile ':mwgt:2.0.1-SNAPSHOT'
}

Eclipse (and IntelliJ, too) then recognizes the corresponding sources-Jar and connects them correctly.