[GRADLE-2199] IvyArtifactRepository does not handle dynamic artifact versions Created: 27/Mar/12  Updated: 04/Jan/13  Resolved: 23/Jul/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: 1.1-rc-1

Type: Bug
Reporter: Seth Goings Assignee: Unassigned
Resolution: Fixed Votes: 1


 Description   

I have a gradle script that looks something like:

repositories {

maven {
credentials

{ username "<username>" password "<password>" }
url "https://artifactory.company.com/artifactory/repo"
}

ivy {
credentials { username "<username>" password "<password>" }

url "https://artifactory.company.com/artifactory/ext-releases-local"
layout "maven"
}

}

dependencies

{ compile group:"com.google.protobuf", name:"protobuf-java", version:"latest.release" compile group:"com.company.protobuf", name:"protoc-$platform-$arch", version:"latest.release" }

The first defined dependency (protobuf-java) resolves fine using the dynamic version "latest.release" (note that this is a true maven artifact, living on our internal artifactory with a pom). The second dependency "protoc-linux-x86_64" is a pure ivy artifact in artifactory, and gradle chokes at the idea of using latest.release as a version. If I specify 2.4.1 instead of latest.release as protoc's version, gradle continues without any problem.



 Comments   
Comment by Seth Goings [ 28/Mar/12 ]

Sorry about the bad formatting... that code section above should look like:

repositories {

  maven {
    credentials { 
      username "<username>" 
      password "<password>" 
    }
    url "https://artifactory.company.com/artifactory/repo"
  }

  ivy {
    credentials { 
      username "<username>" 
      password "<password>" 
    }
    url "https://artifactory.company.com/artifactory/ext-releases-local"
    layout "maven"
  }

}

dependencies { 
  compile group:"com.google.protobuf", name:"protobuf-java", version:"latest.release" 
  compile group:"com.company.protobuf", name:"protoc-$platform-$arch", version:"latest.release" 
}

Comment by Adam Murdoch [ 08/May/12 ]

You might be running into GRADLE-2279. Does the ivy.xml for protoc-linux-x86_64 include default=true in the <info> element?

Comment by Seth Goings [ 09/May/12 ]

GRADLE-2279. The ivy.xml for the dependency is:

<ivy-module version="2.0">
  <info organisation="com.company.protobuf" module="protoc-linux-x86_64" revision="2.4.1.1" status="release" publication="20120130142639"/>
 
  <publications>
    <artifact name="protoc-linux-x86_64" ext="tar.gz"/>
  </publications>
   
</ivy-module>
Comment by Adam Murdoch [ 09/May/12 ]

Do you have a stack trace for the failure? You can get this by running Gradle with the --stacktrace command-line option.

Comment by Seth Goings [ 09/May/12 ]

When I have:

compile group:"com.company.protobuf", name:"protoc-$platform-$arch", version:"2.4.1+"

or

compile group:"com.company.protobuf", name:"protoc-$platform-$arch", version:"latest.release"

(where a valid version exists with version 2.4.1.1)

And run gradle dependencies --stacktrace, I receive errors that pretty much follow the form pasted below:

$> gradle dependencies --stacktrace
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Classpath for compiling the main sources.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dependencies'.
> Could not resolve all dependencies for configuration ':compile'.
   > Could not find any version that matches group:com.company.protobuf, module:protoc-linux-x86_64, version:latest.release.
     Required by:
         :core_protocol:unspecified

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':dependencies'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
	at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
	at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:200)
	at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:172)
	at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:111)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
	at org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
	at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
	at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
	at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:103)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
	at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
	at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
	at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
	at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
	at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:45)
	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:67)
	at org.gradle.launcher.daemon.protocol.Build.run(Build.java:63)
	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:28)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:116)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$4.call(ForwardClientInput.java:114)
	at org.gradle.util.Swapper.swap(Swapper.java:38)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:114)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:61)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSendingCommand.java:21)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:27)
	at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
	at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:55)
	at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:123)
	at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compile'.
	at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.rethrowFailure(DefaultLenientConfiguration.java:51)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.rethrowFailure(DefaultResolvedConfiguration.java:36)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.getFirstLevelModuleDependencies(DefaultResolvedConfiguration.java:49)
	at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$1.getFirstLevelModuleDependencies(SelfResolvingDependencyResolver.java:65)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFirstLevelModuleDependencies(ErrorHandlingArtifactDependencyResolver.java:86)
	at org.gradle.api.tasks.diagnostics.internal.AsciiReportRenderer.render(AsciiReportRenderer.java:78)
	at org.gradle.api.tasks.diagnostics.DependencyReportTask.generate(DependencyReportTask.java:63)
	at org.gradle.api.tasks.diagnostics.AbstractReportTask.generate(AbstractReportTask.java:67)
	at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)
	at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)
	at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:99)
	at org.gradle.api.tasks.diagnostics.DependencyReportTask_Decorated.invokeMethod(Unknown Source)
	at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:150)
	at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$4.execute(AnnotationProcessingTaskFactory.java:145)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:477)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:466)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
	... 78 more
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundException: Could not find any version that matches group:com.company.protobuf, module:protoc-linux-x86_64, version:latest.release.
Required by:
    :core_protocol:unspecified
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$DynamicVersionResolveResult.notFound(LazyDependencyToModuleResolver.java:184)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$StaticVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:118)
	at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver.resolve(LazyDependencyToModuleResolver.java:43)
	at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:43)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:849)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:270)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:83)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:53)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:67)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:36)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:34)
	at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
	at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:99)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:49)
	at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:34)
	at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:42)
	at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:78)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:36)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:236)
	at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
	... 90 more


BUILD FAILED

Total time: 5.63 secs
Comment by Daz DeBoer [ 28/Jun/12 ]

I think this is a duplicate of GRADLE-2318: Repository credentials not used when resolving dynamic versions from an Ivy repository

Generated at Wed Jun 30 12:15:24 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.