Finds the dependecy in first maven repo but continues to check it in other repo as well

(akk) #1

I am facing a strange issue after I started using “com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13”. I have defined 3 maven repositories in And when I do ./gradlew clean tomcatRun, in the logs I see that graldew does find the dependency from the first repo but then continues to find it in other repo as well. For example:

With jmeter plugin:

HEAD org/apache/tomcat/embed/tomcat-embed-core/7.0.54/tomcat-embed-core-7.0.54.p om HTTP/1.1
Host: first host
HTTP/1.1 200 OK
X-Artifactory-Filename: tomcat-embed-core-7.0.54.pom

HEAD org/apache/tomcat/embed/tomcat-embed-core/7.0.54/tomcat-embed-core-7.0.54.pom HTTP/1.1
Host: second host
HTTP/1.1 409 Conflict

Without jmeter plugin everything works fine and gradlew does not try to get the artifact once it successfully gets it from first repo.

(akk) #2

./gradlew --version
Gradle 2.3
Groovy: 2.3.9
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_79 (Oracle Corporation 24.79-b02)
OS: Mac OS X 10.10.5 x86_64

Any help would be greatly appreciated.

(akk) #4

I am not using dynamic dependencies in the build.gralde file that is no where I have specified a version with a “+”. In addition the error occurs only when I include the jmeter plugin, without that plugin everything works fine.

This is how I have included the plugin in buildscript/dependencies:
classpath (‘com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13’) {
exclude group: 'servletapi’
exclude group: ‘org.bouncycastle’

and then
apply plugin: ‘jmeter’

(Eric Wendelin) #5

Hi @akk. A couple quick questions to help me investigate:

  • Given the jmeter plugin and removing the first maven repo, how does the build behave if you run ./gradlew clean tomcatRun --refresh-dependencies?
  • Are your repositories public or private?
  • The HTTP 409 on a HEAD request seems odd to me. What do you get if you request directly, e.g. curl -v -X HEAD [repo_url]/org/apache/tomcat/embed/tomcat-embed-core/7.0.54/tomcat-embed-core-7.0.54.pom?


(akk) #6

If I remove the jmeter plugin, everything runs fine, that is the dependency is picked from the first repo and after that gradle does not try to get it from the subsequent repositories.

Repositories are private and public. The first repository is private and it has the required dependency and I do see a 200 OK in the logs ( mentioned in my original post)

the curl also returns a 409, the repo in this case is

User-Agent: curl/7.43.0
Accept: /

< HTTP/1.1 409 Conflict

(akk) #7

Sorry I misread your first question, if I remove first maven repo then everything blows up because I have lot of artifacts that are only present in my local maven repo. I get a bunch of (Received status code 409 from server: Conflict)

(akk) #8

Any advice, help would be appreciated

(Eric Wendelin) #9

I’m guessing there’s something possibly wrong with your repositories {} config.

This works for me:

curl -v -X HEAD

Perhaps you should set the repo url to if it isn’t that already. You might consider if other artifacts are resolved from for you or if you should remove that repo entirely.

(akk) #10

OK so I added, previously it was pointing to “oss-snapshot-local” as I had some snapshot dependencies. But still the same thing now it trying to get the dependency from the third repository (which is private).

What is weird is that the dependencies exists in my private repo (which is the first repo) and also in which is the second repo.

(akk) #11

More info: The dependency is stored in .gradle/caches/modules-2/metadata-2.14/descriptors/.

Right now I comment the jmeter plugin, start tomcat, this downloads the dependencies and stores it in “.gradle/caches/modules-2/metadata-2.14/descriptors/.” Now when I uncomment the jmeter plugin everything works fine. This is a temporary fix for now.

(akk) #12

OK so I created a new project which has the following simple build file:

buildscript {
repositories {
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.5’
classpath (‘com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13’)

apply plugin: 'java’
apply plugin: 'war’
apply plugin: 'tomcat’
apply plugin: ‘jmeter’

task wrapper(type: Wrapper) {
gradleVersion = ‘2.3’

def tomcatVersion = ‘7.0.54’

repositories {
maven { url ’’ }

dependencies {

testCompile 'junit:junit:4.12'
providedCompile "javax.servlet:javax.servlet-api:3.0.1"

tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
tomcat "org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
    exclude group: "org.eclipse.jdt.core.compiler", module: "ecj"


jmeterRun.configure {

jmeterTestFiles = [ file(“src/test/jmeter/Test.jmx”) ]

jmeterPropertyFile = file(“src/test/jmeter/”)
jmeterUserProperties = [“SERVER=”+System.getProperty(‘SERVER’,“localhost”),“PORT=”+System.getProperty(‘PORT’,“8080”)]


OUTPUT on running: ./gradlew clean tomcatRun

Execution failed for task ‘:tomcatRun’.

Could not resolve all dependencies for configuration ‘:tomcat’.
Could not find org.apache.tomcat.embed:tomcat-embed-core:7.0.54.
Searched in the following locations:
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
Required by:
Could not find org.apache.tomcat.embed:tomcat-embed-logging-log4j:7.0.54.
Searched in the following locations:
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
Required by:
Could not find org.apache.tomcat.embed:tomcat-embed-jasper:7.0.54.
Searched in the following locations:
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
file:/Users/akk/Documents/workspace/SampleGradle/ http:/
Required by:

(Eric Wendelin) #13

Thanks very much for the full example. I’ll reproduce what you’re seeing and look into it.

(Eric Wendelin) #14

I have reproduced this locally.

It seems that changing the repo or the version of tomcat have no effect on the error, which means it must be something else. I see gradle resolving the JAR, which makes me think that maybe some dependencies are missing or there is a conflict with the version of the tomcat plugin you’re running. Perhaps you could start with a simple example provided by the latest gradle-tomcat-plugin (assuming that works) and build up from there.


(akk) #15

even the latest tomcat plugin : classpath ‘com.bmuschko:gradle-tomcat-plugin:2.2.4’ does not work