Problem with dependency compilation

Having issues adding following dependency. See below for error info.

dependency declaration:
compile (“org.neo4j.app:neo4j-server:2.2.1:static-web”){
exclude group: “org.mortbay.jetty”, module: “servlet-api”
}

Error Message:

Archive for required library: ‘/Users/guesy/.gradle/caches/modules-2/files-2.1/org.neo4j/neo4j/2.2.1/256d71126dd47a52b88b6602cb87f2ca337e58d8/neo4j-2.2.1.pom’

Tried deleting with no luck ~/.gradle/caches/modules-2/files-2.1/org.neo4j/neo4j/2.2.1

This typically means that the POM declares an archive packaging type (anything other than pom) yet the archive doesn’t exist in the repository. I was able to resolve the dependency you listed above from Maven central. If you are pointing to an internal repository you might want to check if there are some missing artifacts.

i tried deleting the local .m2/repository dir and downloading again.

See anything out of place with build file?

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'tomcat'
sourceCompatibility = 1.8
version = '1.0'
group = 'com.foo'

description = " "

sourceCompatibility = 1.8
targetCompatibility = 1.8


buildscript {
    repositories { 
        jcenter()
       //mavenLocal()
        //mavenCentral()
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.9'
    }
}

war {baseName = 'com.foo'}

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

    compile ("org.springframework:spring-context:$springVersion"){
    	exclude group: "commons-logging", module: "commons-logging"
    }
    compile "org.springframework:spring-orm:$springVersion"
    compile "org.springframework.amqp:spring-rabbit:$springRabbitVersion"
    compile "org.springframework:spring-jdbc:$springVersion"
    compile "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
    compile "org.springframework:spring-tx:$springVersion"
    compile "org.springframework:spring-web:$springVersion"
    compile "org.springframework:spring-webmvc:$springVersion"
    compile "org.springframework:spring-test:$springVersion"
    
    compile "org.springframework.security:spring-security-config:$springSecurityVersion"
    compile "org.springframework.security:spring-security-web:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
    compile "org.springframework.security:spring-security-core:$springSecurityVersion"
    compile "org.springframework.security:spring-security-taglibs:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
    ...
    compile ("org.neo4j.app:neo4j-server:$neo4jServer:static-web"){
    	exclude group: "org.mortbay.jetty", module: "servlet-api"
    }    
    		   
}

repositories {
	//jcenter()
	 mavenCentral()
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.1'
}


jar {
    manifest {
        attributes 'Implementation-Title': 'App Name',
                   'Implementation-Version': version
    }
}


test {
    systemProperties 'property': 'value'
    
}

uploadArchives {
    repositories {
       flatDir {
           dirs 'repos'
       }
    }
}

Gradle doesn’t use the local Maven repository at ~/.m2/repository unless you declare mavenLocal() as a repository. That said, I was able to get this example to run (assuming the latest versions for Spring). You might try running your build with the --refresh-dependencies option or as a last resort deleting the entire ~/.gradle/caches directory.

Cache delete does not work for me either.

Can you post the output of gradle --version?

Gradle 2.3

Build time: 2015-02-16 05:09:33 UTC
Build number: none
Revision: 586be72bf6e3df1ee7676d1f2a3afd9157341274

Groovy: 2.3.9
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.8.0 (Oracle Corporation 25.0-b70)
OS: Mac OS X 10.10.3 x86_64

I’m still not able to reproduce this issue. There is nothing standing out to me. You may want to try running your build with -i or -d to get some more info. Specifically, what is the file it is trying to find which it believes to be missing.

Here is the console output

Archive for required library: ‘/Users/foo/.gradle/caches/modules-2/files-2.1/org.neo4j/neo4j/2.2.1/256d71126dd47a52b88b6602cb87f2ca337e58d8/neo4j-2.2.1.pom’

Archive for required library: ‘/Users/foo/.gradle/caches/modules-2/files-2.1/org.neo4j/neo4j/2.2.1/256d71126dd47a52b88b6602cb87f2ca337e58d8/neo4j-2.2.1.pom’ in project ‘ProjectX’ cannot be read or is not a valid ZIP file

-i option gives the following info

Could not find org.neo4j:neo4j-cypher-dsl:2.0.1.
Searched in the following locations:
https://jcenter.bintray.com/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.pom
https://jcenter.bintray.com/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.jar
Required by:
com.foo:ProjectX:1.0 > org.springframework.data:spring-data-neo4j:3.3.0.RELEASE

The build script you originally posted didn’t include the ‘spring-data-neo4j’ dependency which is what is causing your build to fail. It depends on a version of ‘neo4j-cypher-dsl’ that exists in neither maven central nor jcenter for some reason. I was able to get the build to work by adding the Spring repo to the build.

repositories {
    maven {
         url = 'http://repo.spring.io/repo/'
     }
}

You may want to contact the Spring Data Neo4j folks about this. When I looked at their artifactory to see where this dependency was coming from, it was referencing a Neo4j repository that no longer exists.

Can I have a look at your build.gradle?

The following works for me. I had to 1) add ‘spring-data-neo4j’ just to get it to fail in the first place, 2) guess on the dependency versions since I assume you have them defined in a gradle.properties file or similar and 3) add the Spring repository to get the ‘neo4j-cypher-dsl’ dependency to resolve.

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'tomcat'
sourceCompatibility = 1.8
version = '1.0'
group = 'com.foo'

description = " "

sourceCompatibility = 1.8
targetCompatibility = 1.8


buildscript {
    repositories { 
        jcenter()
       //mavenLocal()
        //mavenCentral()
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.9'
    }
}

war {baseName = 'com.foo'}

ext {
    tomcatVersion = '7.0.0'
    springVersion = 'latest.release'
    springRabbitVersion = 'latest.release'
    springSecurityVersion = 'latest.release'
    springDataCommonsVersion = 'latest.release'
    neo4jServer = '2.1.1'
}

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

    compile ("org.springframework:spring-context:$springVersion"){
    	exclude group: "commons-logging", module: "commons-logging"
    }
    compile "org.springframework:spring-orm:$springVersion"
    compile "org.springframework.amqp:spring-rabbit:$springRabbitVersion"
    compile "org.springframework:spring-jdbc:$springVersion"
    compile "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
    compile "org.springframework:spring-tx:$springVersion"
    compile "org.springframework:spring-web:$springVersion"
    compile "org.springframework:spring-webmvc:$springVersion"
    compile "org.springframework:spring-test:$springVersion"
    
    compile "org.springframework.security:spring-security-config:$springSecurityVersion"
    compile "org.springframework.security:spring-security-web:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
    compile "org.springframework.security:spring-security-core:$springSecurityVersion"
    compile "org.springframework.security:spring-security-taglibs:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
    
    compile ("org.neo4j.app:neo4j-server:$neo4jServer:static-web"){
    	exclude group: "org.mortbay.jetty", module: "servlet-api"
    }    
    		
    compile 'org.springframework.data:spring-data-neo4j:3.3.0.RELEASE'   
}

repositories {
	//jcenter()
	 mavenCentral()
     maven {
         url = 'http://repo.spring.io/repo/'
     }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.1'
}


jar {
    manifest {
        attributes 'Implementation-Title': 'App Name',
                   'Implementation-Version': version
    }
}


test {
    systemProperties 'property': 'value'
    
}

uploadArchives {
    repositories {
       flatDir {
           dirs 'repos'
       }
    }
}

Can you try the following build.gradle (build.properties included) and see if it works for you?

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'tomcat'
version = '1.0'
group = 'com.foo'

description = ""

sourceCompatibility = 1.8
targetCompatibility = 1.8


buildscript {
    repositories { 
        jcenter()
       //mavenLocal()
        //mavenCentral()
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:0.9.9'
    }
}

war {baseName = 'com.foo'}

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

    compile ("org.springframework:spring-context:$springVersion"){
    	exclude group: "commons-logging", module: "commons-logging"
    }
    compile "org.springframework:spring-orm:$springVersion"
    compile "org.springframework.amqp:spring-rabbit:$springRabbitVersion"
    compile "org.springframework:spring-jdbc:$springVersion"
    compile "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
    compile "org.springframework:spring-tx:$springVersion"
    compile "org.springframework:spring-web:$springVersion"
    compile "org.springframework:spring-webmvc:$springVersion"
    compile "org.springframework:spring-test:$springVersion"
    
    compile "org.springframework.security:spring-security-config:$springSecurityVersion"
    compile "org.springframework.security:spring-security-web:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"
    compile "org.springframework.security:spring-security-core:$springSecurityVersion"
    compile "org.springframework.security:spring-security-taglibs:$springSecurityVersion"
    compile "org.springframework.security:spring-security-crypto:$springSecurityVersion"

    compile "org.springframework.social:spring-social-config:$springSocialVersion"
    compile "org.springframework.social:spring-social-core:$springSocialVersion"
    compile "org.springframework.social:spring-social-web:$springSocialVersion"
    compile "org.springframework.social:spring-social-security:$springSocialVersion"
    compile "org.springframework.social:spring-social-facebook:$springSocialFacebookVersion"
    compile "org.springframework.social:spring-social-facebook-web:$springSocialFacebookVersion"
    compile "org.springframework.social:spring-social-twitter:$springSocialTwitterVersion"
    compile "org.springframework.social:spring-social-linkedin:$springSocialLinkedInVersion"
    compile "org.springframework.social:spring-social-yahoo:$springSocialYahooVersion"
	
    compile "org.thymeleaf:thymeleaf-spring4:$thymeleafVersion"
    compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:$thymeleafLayoutVersion"
    compile "org.apache.httpcomponents:httpclient:$httpclientVersion"
    compile "javax.validation:validation-api:$javaxValidationVersion"
    compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
    compile "org.slf4j:slf4j-api:$slf4jVersion"
    compile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
    compile "org.slf4j:slf4j-log4j12:$slf4jVersion"
    compile "log4j:log4j:$log4jVersion"
    compile "com.h2database:h2:$h2Version"
    compile "cglib:cglib-nodep:$cglibVersion"
    compile "javax.inject:javax.inject:$javaxInjectVersion"
    compile "commons-codec:commons-codec:$commonsCodecVersion"
    compile "org.apache.tiles:tiles-api:$tilesCoreVersion"
    compile "org.apache.tiles:tiles-core:$tilesCoreVersion"
    compile "org.apache.tiles:tiles-extras:$tilesCoreVersion"
    compile "org.apache.tiles:tiles-template:$tilesCoreVersion"
    compile "org.apache.tiles:tiles-servlet:$tilesServletVersion"
    compile "com.google.guava:guava:$guavaVersion"
    compile "org.hibernate:hibernate-entitymanager:$hibernateEntityManagerVersion"
    compile "org.springframework.data:spring-data-jpa:$springDataJpaVersion"
    compile "commons-lang:commons-lang:$commonsLangVersion"
    compile "commons-io:commons-io:$commonsIOVersion"
    compile "org.jadira.usertype:usertype.core:$usertypeCoreVersion"
    compile "javax.persistence:persistence-api:$persistenceApiVersion"
    compile "org.javassist:javassist:$javassistVersion"
    compile "com.fasterxml.jackson.datatype:jackson-datatype-hibernate4:$jacksonDataTypeHibernateVersion"
    compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jacksonDataTypeJodaVersion"
    compile "mysql:mysql-connector-java:$mysqlConnectorVersion"
    compile "javax.servlet:jstl:$jstlVersion"
    compile "org.apache.tiles:tiles-request-api:$tilesRequestApiVersion"
    compile "org.apache.commons:commons-digester3:$commonsDigester3Version"
    compile "commons-beanutils:commons-beanutils:$commonsBeanutilsVersion"
    
    compile "org.springframework:spring-aop:$springVersion"
    compile "org.quartz-scheduler:quartz:$quartzVersion"
    compile "org.springframework:spring-context-support:$springVersion"    
    providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"    
 	compile "javax.validation:validation-api:$validationApiVersion"
    
    compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
    compile "org.aspectj:aspectjrt:$aspectjrtVersion"
    
    compile("ch.qos.logback:logback-classic:$logbackClassicVersion"){
    	exclude group: "javax.mail", module: "mail"
    	exclude group: "javax.jms", module: "jms"
    	exclude group: "com.sun.jdmk", module: "jmxtools"
    	exclude group: "com.sun.jmx", module: "jmxri"
    }
    
    compile "org.springframework:spring-aspects:$springAspectsVersion"
    compile "org.thymeleaf.extras:thymeleaf-extras-tiles2:$thymeleafExtrasTiles2Version"
    compile "org.thymeleaf.extras:thymeleaf-extras-tiles2-spring4:$thymeleafExtrasTiles2Spring4Version"
    compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity3:$thymeleafExtrasSpringSecurity3Version"
    compile "org.apache.tiles:tiles-core:$tilesCoreVersion"
    compile "org.apache.tiles:tiles-servlet:$tilesServletVersion"
    compile "org.springframework.webflow:spring-js:$springJsVersion"
    compile "joda-time:joda-time:$jodaTimeVersion"
    compile "joda-time:joda-time-hibernate:$jodaTimeHibernateVersion"
    compile "joda-time:joda-time-jsptags:$jodaTimeJspTagsVersion"
    compile "org.jadira.usertype:usertype.core:$usertypeCoreVersion"
    compile "com.rosaloves:bitlyj:$bitlyjVersion"
    compile "org.mockito:mockito-core:$mockitoCoreVersion"
    compile "org.apache.commons:commons-pool2:$commonsPool2Version"
    compile "org.springframework.data:spring-data-neo4j:$springDataNeo4jVersion"
    compile "org.springframework.data:spring-data-neo4j-rest:$springDataNeo4jVersion"    
    compile "net.sf.ehcache:ehcache-core:$ehcacheCoreVersion"
    
    compile "org.springframework.data:spring-data-redis:$springDataRedisVersion"
    compile "org.springframework.data:spring-data-solr:$springDataSolrVersion"
    compile "org.glassfish.jersey.connectors:jersey-apache-connector:$jerseyApacheConnectorVersion"
    compile "org.springframework.data:spring-data-commons:$springDataCommonsVersion"
    compile "dbunit:dbunit:$dbunitVersion"
    compile "org.apache.poi:poi:$poiVersion"
	compile "com.h2database:h2:$h2Version"
	compile "org.javassist:javassist:$javsistVersion"
	compile "redis.clients:jedis:$jedisVersion"
	compile "mysql:mysql-connector-java:$mysqlConnectorJavaVersion"
	testCompile "com.jayway.jsonpath:json-path-assert:$jsonPathAssertVersion"
	testCompile "org.apache.solr:solr-core:$solrCoreVersion"
	providedRuntime "javax.servlet.jsp:jsp-api:$jspApiVersion"
	compile "org.neo4j:neo4j-cypher:$neo4jCypherVersion"
	compile "org.neo4j:neo4j-cypher:2.3.0-M01"
	
	compile ("org.neo4j.app:neo4j-server:$neo4jServer:static-web"){
    	exclude group: "org.mortbay.jetty", module: "servlet-api"
    }    
    		   
}

repositories {
    jcenter()
    mavenLocal()
	//mavenCentral()
    maven { url 'http://repo.spring.io/libs-staging-local'}
    maven { url 'http://repo.spring.io/release' }
    maven { url 'http://repo.spring.io/milestone' }
    maven { url 'http://repo.spring.io/snapshot' }
    maven { url 'http://download.java.net/maven/2' }
    maven { url 'http://repository.springsource.com/maven/bundles/release' }
    maven { url 'http://repository.springsource.com/maven/bundles/external' }
    maven { url 'http://repository.springsource.com/maven/bundles/milestone' }
    maven { url 'http://repository.springsource.com/maven/bundles/snapshot' }
    maven { url 'https://repository.jboss.org/nexus/content/repositories/releases' }
    maven { url 'http://maven.springframework.org/snapshot' }
    maven { url 'http://m2.neo4j.org/releases' }    
    maven { url 'http://repo.springsource.org/libs-snapshot' }
    maven { url 'http://repo.spring.io/snapshot' }
    maven { url 'http://repo1.maven.org/maven2/' }
    maven { url 'http://oauth.googlecode.com/svn/code/maven' }
    maven { url 'https://raw.github.com/plechi/spring-security-scribe/mvn-repo/' }
    maven { url = 'http://repo.spring.io/repo/' }
                          
   
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}


jar {
    manifest {
        attributes 'Implementation-Title': 'Foo',
                   'Implementation-Version': version
    }
}


test {
    systemProperties 'property': 'value'
    
}

uploadArchives {
    repositories {
       flatDir {
           dirs 'repos'
       }
    }
}     

gradle.properties file

cglibVersion = 2.2
h2Version = 1.3.175
hibernateValidatorVersion = 4.1.0.Final
httpclientVersion = 4.3.1
javaxInjectVersion = 1
javaxValidationVersion = 1.0.0.GA
log4jVersion = 1.2.16
servletApiVersion = 3.0.1
slf4jVersion = 1.7.5
springSecurityVersion = 4.0.1.RELEASE
springSocialVersion = 1.1.0.RELEASE
springSocialFacebookVersion = 2.0.1.RELEASE
springSocialTwitterVersion = 1.1.0.RELEASE
springSocialLinkedInVersion = 1.0.0.RELEASE
springSocialYahooVersion = 1.0-SNAPSHOT
springVersion = 4.1.5.RELEASE
thymeleafVersion = 2.1.2.RELEASE
thymeleafLayoutVersion = 1.2.2
tomcatVersion = 7.0.42
commonsCodecVersion = 1.8
tilesCoreVersion = 2.2.2
tilesServletVersion = 2.2.2
guavaVersion = 18.0
hibernateEntityManagerVersion = 4.3.6.Final
springDataVersion = 1.6.4.RELEASE
springDataJpaVersion=1.8.0.RELEASE
commonsLangVersion = 2.6
commonsIOVersion = 2.4
usertypeCoreVersion = 3.1.0.CR8
persistenceApiVersion = 1.0.2
springDataCommonsVersion = 1.8.0.RELEASE
javassistVersion = 3.19.0-GA
jacksonDataTypeHibernateVersion = 2.2.3
jacksonDataTypeJodaVersion = 2.4.0-rc3
mysqlConnectorVersion = 5.1.32
jstlVersion = 1.2
quartzVersion=2.2.1
validationApiVersion=1.1.0.Final
hibernateValidatorVersion=5.0.1.Final
aspectjrtVersion=1.7.3
logbackClassicVersion=1.1.3
springAspectsVersion=4.1.6.RELEASE
thymeleafExtrasTiles2Version=2.1.1.RELEASE
thymeleafExtrasTiles2Spring4Version=2.1.1.RELEASE
thymeleafExtrasSpringSecurity3Version=2.1.2.RELEASE
tilesCoreVersion=3.0.5
tilesServlet=3.0.5
springJsVersion=2.4.1.RELEASE
jodaTimeVersion=2.7
jodaTimeHibernateVersion=1.4
jodaTimeJspTagsVersion=1.1.1
usertypeCoreVersion=3.2.0.GA
bitlyjVersion=2.0.0
mockitoCoreVersion=2.0.6-beta
commonsPool2Version=2.3
springDataNeo4jVersion=3.3.0.RELEASE
neo4jCypherVersion=2.2.1
neo4jServer=2.2.1
springDataRedisVersion=1.5.0.RELEASE
springDataSolrVersion=1.4.0.RELEASE
jerseyApacheConnectorVersion=2.17
springDataCommonsVersion=1.10.0.RELEASE
dbunitVersion=2.2
poiVersion=3.2-FINAL
h2Version=1.4.187
javsistVersion=3.19.0-GA
jedisVersion=2.7.0
mysqlConnectorJavaVersion=5.1.35
springRabbitVersion=1.4.4.RELEASE
jsonPathAssertVersion=2.0.0
solrCoreVersion=5.1.0
jspApiVersion=2.1
ehcacheCoreVersion=2.6.11
tilesRequestApiVersion=1.0.6
commonsDigester3Version=3.2
commonsBeanutilsVersion=1.9.2