Gradle 1.9 with --parallel is failing randomly


(Jörn Huxhorn) #1

Building e.g. sulky with ‘gradlew --parallel’ is randomly failing with exceptions like this one:

http://pastebin.com/V1yWJHAE

‘org.apache.maven.project.interpolation.ModelInterpolationException: Failed to interpolate field: private java.lang.String org.apache.maven.model.Reporting.outputDirectory on class: org.apache.maven.model.Reporting’ caused by ‘java.lang.IllegalAccessException: Class org.apache.maven.project.interpolation.StringSearchModelInterpolator$InterpolateObjectAction can not access a member of class org.apache.maven.model.Reporting with modifiers “private”’

“Randomly” means that the build isn’t always failing and that it’s failing in random modules. It seems to be easier to reproduce after all modules have already been built once/are UP-TO-DATE. My computer is relatively fast and has an SSD drive - just in case that this is relevant to reproduce the issue.

------------------------------------------------------------ Gradle 1.9 ------------------------------------------------------------

Build time:

2013-11-19 08:20:02 UTC Build number: none Revision:

7970ec3503b4f5767ee1c1c69f8b4186c4763e3d

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_45 (Oracle Corporation 24.45-b08) OS:

Mac OS X 10.9 x86_64


(René Groeschke) #2

Hey huxi,

I have a build locally available that exactly produces this error. thanks for reporting. It seems that the generation of the pom file is not thread safe I guess.


(René Groeschke) #3

Hello, the Upload task uses the ant maven deploy tasks under the hood which are not thread safe. This is just one flaw of the ant maven deploy tasks. One option for you might be to go with the new (incubating) maven-publish plugin, which is designed to support in parallel execution.

cheers, René


(Jörn Huxhorn) #4

I primarily wanted to raise the flag for you.

I need to take a deeper look at the maven-publish plugin. It looks a bit complicated and hand-crafted at the moment. Incubating… :slight_smile: I’m not immediately sure what I need to do to create jar, sources and javadoc - including optional signatures for release artifacts. That part (including the pom manipulation) is by far the most complex part of my current build. This makes me a bit hesitant.

I guess(!!) something along those lines:

task javadoc(type: Javadoc) {
 destinationDir = file("$buildDir/javadoc")
 source = files { subprojects.collect { it.sourceSets.main.java } }
 classpath = files { subprojects.collect { it.sourceSets.main.compileClasspath } }
}
  task sourceJar(type: Jar) {
 from sourceSets.main.allJava // this is allSource in my build
}
  task javadocJar(type: Jar) {
 from javadoc.outputs.files
}
  publishing {
 publications {
  mavenJava(MavenPublication) {
   from components.java
       artifact sourceJar {
    classifier "sources"
   }
        artifact javadocJar {
    classifier "javadoc"
   }
  }
 }
   repositories {
  maven {
   // no idea how to specify different snapshot and release repos
   // or should this be initialized differently for snapshot and release?
  }
 }
}