"Failed to validate POM for project" in uploading artifacts task

Hi all,

We have a big problem with uploading task. Uploading fails with generic “Failed to validate POM for project” and no more information. The build always fails when uploading the jar for war subprojects, both using the original publishing mechanism and the new maven-publish plugin.

We try with gradle version 1.5, 1.6 and 1.7, but the error is always the same. Here a gist with the stack trace.

Follows an excerpt of our last attempt of configuring the upload for subprojects

subprojects {subprj->

configurations {

batchConfig

}

artifacts{

batchConfig jar

}

uploadBatchConfig{

repositories {

mavenDeployer {

repository(url: “file:///tmp/m2/”)

}

}

}

rootProject.uploadBatchConfig.dependsOn subprj.uploadBatchConfig

}

It could be our fault (the multiproject build is quite complex) but without further details on the validation failure cause, we have no chances to fix it.

Have you investigated the POM mentioned in the exception message?

Yes I have. For me the POM appears correct.

I uploaded it in a gist

First thing I’d do is to verify this POM against its schema.

I’ve already checked this thing and it successfully passes the validation

Looking at the code, I don’t understand why the root cause is missing from the output. Can you show the stack trace when running with ‘–full-stacktrace’?

Here you can found the stack trace when running with --full-stacktrace.

Unfortunally gradle don’t show the “real” problem!

As you can see from the stack trace, Gradle is calling into Maven here, and apparently the only thing it gets back is this exception. I’ll see if I can find something in the Maven sources.

To get a meaningful error message, Gradle would have to specifically catch ‘org.apache.maven.project.InvalidProjectModelException’ and output ‘exception.getValidationResult().toString()’. I’ve raised GRADLE-2907 for this. Meanwhile, the only way to get at the message is to debug Gradle yourself. One way to do this is to run Gradle with ‘–no-daemon -Dorg.gradle.debug=true’, connect a remote debugger on port 5005, and set an exception breakpoint for class ‘InvalidProjectModelException’. Sorry that I don’t have an easier solution.

Thanks for the help Peter!

I’ll try to debug following your instructions.

Debugging I discover that the invalid project model exception is filled with some validation failures complaining for missing groupId.

In the build.gradle there are some dependencies to libraries in a local repository that are defined without group. I tried to modify this dependencies declaration, I define a “fake group” “nogroup” and the uploadArchives task now works.