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


(Andrea Schiona) #1

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.


(Peter Niederwieser) #2

Have you investigated the POM mentioned in the exception message?


(Andrea Schiona) #3

Yes I have. For me the POM appears correct.

I uploaded it in a gist


(Peter Niederwieser) #4

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


(Andrea Schiona) #5

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


(Peter Niederwieser) #6

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’?


(Andrea Schiona) #7

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

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


(Peter Niederwieser) #8

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.


(Peter Niederwieser) #9

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.


(Andrea Schiona) #10

Thanks for the help Peter!

I’ll try to debug following your instructions.


(Andrea Schiona) #11

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.