Tag Archives: gradle

Gradle could not resolve commons-logging

My gradle build would fail for an unexpected reason. This could be any common jar but one I know would be in the maven central repo without any problems.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ‘:sham-core:testCompile’.
> Could not download artifact ‘commons-logging:commons-logging:1.1.1@jar’
> Artifact ‘commons-logging:commons-logging:1.1.1@jar’ not found.

Problem with repositories

My build.gradle had the following for resolving repositories

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

Turns out that my maven local had some sort of problem with gradle when the jar is not present in the maven local.

Options to fix this

  1. remove mavenLocal() from your gradle build script
  2. Move the maven local repo mv ~/.m2/repository ~/m2/repo-tmp . Build the project and move it back mv ~/m2/repo-tmp ~/.m2/repository
  3. Delete the maven local repo rm -rf ~/.m2/repository/ .

I do not use much maven so I just did 3.

Advertisements

Gradle groovy compile and out of memory error

Today was my first real day with Gradle.

I struggled for hours trying to get the groovy compile process to have enough memory to compile my code and not fall over with out of memory exceptions. This is what I would usually get.

Started Gradle compiler daemon with fork options DaemonForkOptions{minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[/Users/muz/.gvm/grails/1.3.9/lib/groovy-all-1.7.8.jar, /Users/muz/.gvm/gradle/1.8/lib/ant-1.9.2.jar, /Users/muz/.gvm/gradle/1.8/lib/ant-launcher-1.9.2.jar]}.

Executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@e4865ce in compiler daemon.

Exception executing org.gradle.api.internal.tasks.compile.ApiGroovyCompiler@e4865ce in compiler daemon: java.lang.OutOfMemoryError: Java heap space.

Things that did not work

Continue reading