You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Jan T. Kim" <j....@uea.ac.uk> on 2010/07/06 14:06:27 UTC

Shade plugin: dependency-reduced-pom.xml fails to validate

Dear All,

I've consolidated dependencies in a multi-module project by putting them
all into a dependencyManagement element of the top-level pom.xml so that
dependencies the modules can be simplified. However ``mvn package''
now ends with an error in a module (called import) that's building a
shaded executable jar:

    [INFO] Error creating shaded jar: Failed to validate POM for project isacrodi-proj:import at ./import/dependency-reduced-pom.xml

Running maven with the -e switch gives a stacktrace as expected but
I can't find anything in that to help me identify the problem. Adding
-X didn't flush out anything useful either.

I've restored the dependencies in import module to what they were before
tidying them up but the problem persists. Further, I found that mentioning
the dependencies in the top-level pom.xml causes the problem.

I'm rather mystified by the fact that the ./import/dependency-reduced-pom.xml
which is left after the build failure is identical to
./import/target/dependency-reduced-pom.xml after a successful build.
So the validation failure is not caused by anything in the
dependency-reduced-pom.xml as such, it appears to be caused by validating
dependency-reduced-pom.xml in the context of the parent pom.xml containing
the problematic dependencies in the dependencyManagement element.

A sample dependency in the top level pom.xml is:

    <dependency>
      <groupId>jboss-stuff</groupId>
      <artifactId>jbossall-client</artifactId>
      <version>5.1</version>
      <scope>system</scope>
      <systemPath>${jbosshome}/client/jbossall-client.jar</systemPath>
    </dependency>

In the dependency-reduced-pom.xml file, the jbosshome property is
expanded but otherwise the dependencies are the same.

I'd be grateful for any tips on this topic. Also, if you have any
advice on how to get more specific / meaningful messages on validation
problems out of maven, I'd be very interested -- stack traces seem like
a rather basic format of reporting validation errors, particularly if
there isn't even a line number or some other hint...

Best regards, Jan

P.S.: here's a sample stack trace:

[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error creating shaded jar: Failed to validate POM for project isacrodi-proj:import at /local/home/jtk/devel/isacrodi/trunk/import/dependency-reduced-pom.xml
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: Failed to validate POM for project isacrodi-proj:import at /local/home/jtk/devel/isacrodi/trunk/import/dependency-reduced-pom.xml
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:489)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.apache.maven.project.InvalidProjectModelException: Failed to validate POM for project isacrodi-proj:import at /local/home/jtk/devel/isacrodi/trunk/import/dependency-reduced-pom.xml
        at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1077)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:880)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
        at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:217)
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.createDependencyReducedPom(ShadeMojo.java:799)
        at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:482)
        ... 19 more

-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: j.kim@uea.ac.uk                                 |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org