‘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.
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.
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.
I need to take a deeper look at the maven-publish plugin. It looks a bit complicated and hand-crafted at the moment. Incubating… 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?
}
}
}