Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing dependencies and Dynamic versions don't work - Kotlin DSL #8664

Open
yuranos opened this issue Mar 1, 2019 · 5 comments
Open

Changing dependencies and Dynamic versions don't work - Kotlin DSL #8664

yuranos opened this issue Mar 1, 2019 · 5 comments

Comments

@yuranos
Copy link

yuranos commented Mar 1, 2019

I'm not sure if the problem is in Kotlin DSL, maven-publish plugin or S3 connection.

Gradle 5.2.1
Build time:   2019-02-08 19:00:10 UTC
Revision:     f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL:   1.1.3
Kotlin:       1.3.20
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_181 (Azul Systems, Inc. 25.181-b02)
OS:           Linux 4.15.0-45-generic amd64

We publish our artifacts to S3 via:
`publishing {

publications {
    create<MavenPublication>("publishKotlin") {
        from(components["java"])
        artifact(tasks["sourcesJar"])
    }
}

repositories {
    maven(s3Url) {
        authentication {
            create<AwsImAuthentication>("awsIm")
        }
    }
}

}`

I have configured resolution strategy with 0 cache time:

configurations.all {
    resolutionStrategy {
        cacheChangingModulesFor(0, TimeUnit.SECONDS)
        cacheDynamicVersionsFor(0, TimeUnit.SECONDS)
    }

However, it only works as expected for implicitly changing SNAPSHOT versions, like:

compile("com.yuranos.pixel:pixel-utils:0.0.1-SNAPSHOT")

Other options do not work. For example for:

compile("com.attendify.pixel:pixel-utils:0.0.1+") { setChanging(true) }

a locally cached version is used.

@ljacomet
Copy link
Member

ljacomet commented Mar 1, 2019

Can you be more specific about the problem?

  • Which versions do exist in the repository?
  • Which version is resolved?
  • What did you expect instead?

@yuranos
Copy link
Author

yuranos commented Mar 3, 2019

Sure. I just want to make sure that if I publish a library with the exact same, existing, version but different content, all my services which rely on the library should pick up that change immediately.
I know it's not a best practice, but it's what we need right now for prototyping.
Incidentally, I would also like to know how to force publishing to be immutable. That is, not allow to override existing artifacts, if they are not SNAPSHOTs.

@eskatos
Copy link
Member

eskatos commented Apr 6, 2019

@yuranos could you please come up with a reproducer that demonstrates the issue? I hardly see how this could be related to the Gradle Kotlin DSL. Maybe your issue can be reproduced with Groovy scripts too?

@Jan5366x
Copy link

Jan5366x commented Apr 6, 2019

Hello @eskatos ,

we don't use S3 or other fancy setups like @yuranos and we can confirm that the content of the deployed jars looks just right so we can provide some information related to the "cacheDynamicVersionsFor(0, TimeUnit.SECONDS)" don't have an effect part.

(Note: The Maven dependency jar content has to be changed at least 2-3 times to reproduce this problem)

Snapshot version should look like this: master-SNAPSHOT

kotlin DSL: (don't work)

implementation("de.urlname.framework", "Framework_Shared_Public", project.extra.get("frameworkVersion").toString()).isChanging = true

old groovy version: (has worked just fine)

compile group: 'de.urlname.framework', name: 'Framework_Shared_Public', version:project.frameworkVersion, changing: true

(just if you wonder -> we have changed from compile to implementation but this looks to have no impact to this problem at all)

Currently we have to clear the entire Gradle cache over and over again which is a pain since the entire IDE has to be restarted and everything has to be downloaded and indexed again.

rm -rf $HOME/.gradle/caches/

As I mentioned with groovy it has worked just fine without clearing any caches.

best regards.

@ljacomet ljacomet added the @jvm label Feb 17, 2020
@dnut
Copy link

dnut commented Jun 12, 2020

I can confirm the same problem with the kotlin DSL in gradle 6.0. My organization versions all of our maven artifacts as 1.0.0-SNAPSHOT, so this is a critical feature. I put this in all my gradle files:

configurations.all {
    resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}

But it does not work. Whenever we have changes in a dependency, a new build is automatically triggered on bamboo for the dependent. But that build never works properly. I have to ssh into all of our bamboo servers, rm -rf ~/.gradle/caches, and then rebuild the app. Then it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants