Compile dependencies as jar

Hi,

I’m using Gradle + IDEA to develop my project. I have some subprojects that I want to depend on my main project, so I have:

project(':core') {
    dependencies {
        compile project(':mySubproject')
    }
}

This compiles fine, but at runtime what my app sees in the classpath are the classes of my subproject directly. The problem is, my subprojects are OSGi bundles, so I need them to be JARs with their MANIFEST.MF.

Is there a way of making Gradle or IDEA run my project against my subprojects JARs instead of my subproject classes?

Thank you!

‘compile project(’:mySubproject’)’ will put the subproject’s Jar on the ‘compile’ (and also ‘runtime’) configuration, not its classes. If that’s not what you see, either something is wrong with the rest of your build, or you misinterpreted the results. To print all artifacts on the ‘runtime’ configuration, you can use ‘task debug << { configurations.runtime.each { println it } }’.

Then it must be a JetGradle problem/“feature”. I see compilation been done by Gradle and dependencies being jars for maven artifacts but directories for subprojects.

If I use the “run” task directly in IDEA (instead of creating a normal Application configuration), it works as expected (so you’re right) but then IDEA takes 10 seconds to “unfreeze” every time I stop my project.

I’ll open a ticket with them after asking in their forums, thanks!

If you build in IntelliJ, Gradle isn’t involved, so results may differ.

AFAIK if you have a linked Gradle project, it uses Gradle to build it (and you see it running on the status bar)