I can put together a runnable project zip if needed, but here is a sample
build file showing java registering multiple artifacts. A downstream
project could do any of the following:
provided project(path:":myComplicatedJavaProject",
configuration:"interfaces") // Import interfaces only of the project
compile project(":myComplicatedJavaProject") // import jar with dependencies
compile project(path:":myComplicatedJavaProject", configuration:"fatJar")
// import jar with dependencies, in this example, should do exactly the
same as above
compile project(path:":myComplicatedJavaProject",
configuration:"fatterJar") // import jar with dependencies and other stuff
>From my experience, all of these pull in their parent compile dependencies,
which seems wrong. If the jar you are pulling in packages any of your
parent dependencies (Which could even happen in your interfaces jar,
depending how you generate interfaces) would end up with a dex exception.
Even when it doesn't (say, if you want to link against interfaces, pulling
in upstream dependencies at that stage would be bad).
Let me know if you want a runnable example.
---------------------
configurations {
extra
interfaces
fatJar
fatterJar
}
dependencies {
compile project(":upstream1")
compile project(":upstream2")
extra project(":extra1)
extra project(":extra2)
}
task jarWithDependencies(type: Jar) {
dependsOn configurations.compile
from {
configurations.compile.files.collect {zipTree(it)}
}
from files(sourceSets.main.output.classesDir)
baseName = "jarWithDependencies"
}
task jarWithExtras(type: Jar) {
dependsOn configurations.compile
dependsOn configurations.extra
from {
def deps = configurations.compile + configurations.extra
deps.files.collect {zipTree(it)}
}
from files(sourceSets.main.output.classesDir)
}
task generateInterfaces {...}
task interfacesJar(type: Jar) {
dependsOn generateInterfaces
from generateInterfaces.outputs
}
artifacts {
interfaces interfacesJar
fatJar jarWithDependencies
fatterJar jarWithExtras
}
----------------------------
On Thursday, February 12, 2015 at 7:18:39 PM UTC-8, Xavier Ducrohet wrote:
>
> What other dependencies do you have on the project? How's your java
> project setup?
>
> If you have a small project that reproduce this, it would be nice.
>
> On Wed, Feb 11, 2015 at 1:34 PM, Benjamin Cooley <[email protected]
> <javascript:>> wrote:
>
>> I have a java project that publishes a few different configurations. When
>> I have an android project depend on one of these, it seems to pull in all
>> the transient compile dependencies
>>
>> I think this is a bug.
>>
>> For example, if I have a java project that I publish a jar with all
>> upstream dependencies under a new configuration called jarWithDependencies
>>
>> compile project(path:":my:java:library",
>> configuration:"jarWithDependencies")
>>
>> Would end up with a dex exception because it finds the dependency in the
>> jarWithDependencies & also pulls in that dependency...
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
> http://developer.android.com | http://tools.android.com
>
> Please do not send me questions directly. Thanks!
>
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.