maven pom is invalid

时间:2015-07-28 15:42:53

标签: maven nexus linkageerror

I'm not able to build a project using a maven repository on a linux server. I'm using the same repository on my windows pc and I am able to build it.

WARN The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for com.fasterxml.jackson.core:jackson-core:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
INFO [wsdlgenerator:load-models] Loading models
INFO [wsdlgenerator:load-models] Generating webservices
INFO [wsdlgenerator:perform] Including /apps/visual-rules-6.4.1/server/teamserver/data/VRS_DEFAULT/build/jobs/Master Controller/workspace/IVRS_Common/vr-buildtarget/generated-resources/visual-rules
INFO 
INFO --- maven-resources-plugin:2.6:resources (default-resources) @ IVRS_Common ---
WARN The POM for org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.apache.maven.shared:maven-filtering:jar:1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.codehaus.plexus:plexus-interpolation:jar:1.13 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN Error injecting: org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

maven-filtering:jar:1.1 has a dependency on plexus-container and plexus-interpolation. The missing class is in

<dependency>
          <groupId>org.sonatype.plexus</groupId>
          <artifactId>plexus-build-api</artifactId>
          <version>0.0.4</version>
        </dependency>

The pom for maven-filtering seems to have the wrong relative path even though it works in windows.

<parent>
    <groupId>org.apache.maven.shared</groupId>
    <artifactId>maven-shared-components</artifactId>
    <version>17</version>
    <relativePath>../maven-shared-components/pom.xml</relativePath>
  </parent>

it should be

../../maven-shared-components/17/maven-shared-components-17.pom

I've looked at some other related questions Why do I get invalid pom due to missing dependency.version although the version is managed? and The POM for <name> is invalid, transitive dependencies (if any) will not be available. I've tried running mvn install in the directory containing the maven-filtering pom and the directory of its parent but I get

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory

I tried executing mvn dependency:tree within these same two directories and I get

[ERROR] [ERROR] Invalid packaging for parent POM org.apache.maven.plugins:maven-dependency-plugin:2.8, must be "pom" but is "maven-plugin" 

I went inside the pom for maven-dependency-plugin:2.8 and changed the packaging from maven-plugin to pom and I still get that error. When I make changes to the poms I use this command

mvn deploy:deploy-file -DpomFile=/export/home/user/sonatype-work/nexus/storage/repo/org/apache/maven/shared/maven-filtering/1.1/maven-filtering-1.1.pom \
  -Dfile=/export/home/user/sonatype-work/nexus/storage/repo/org/apache/maven/shared/maven-filtering/1.1/maven-filtering-1.1.jar \
  -DrepositoryId=repo \
  -Durl=http://dendtp102d/nexus/content/repositories/repo

sometimes I just change the pom on the server without executing the deploy command and the changes are reflected when I view the repository in my browser so I'm not sure if it makes a difference.

Edit: Adding more of console output from build

INFO Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14 10:29:23-0700)
INFO Maven home: /apps/visual-rules-6.4.1/tools/apache-maven-3.2.5
INFO Java version: 1.7.0_76, vendor: Oracle Corporation
INFO Java home: /apps/jdk1.7.0_76/jre
INFO Default locale: en_US, platform encoding: UTF-8
INFO OS name: "linux", version: "2.6.32-504.el6.x86_64", arch: "amd64", family: "unix"
INFO Error stacktraces are turned on.
INFO Scanning for projects...
INFO ------------------------------------------------------------------------
INFO Reactor Build Order:
INFO 
INFO Common
INFO Controller
INFO Master_Controller
INFO Controller_2
INFO 
INFO ------------------------------------------------------------------------
INFO Building Common 0.0.1-SNAPSHOT
INFO ------------------------------------------------------------------------
INFO 
INFO --- validation-maven-plugin:6.4.4:validate (default) @ Common ---
INFO [validation:prepare] Starting validation
INFO [validation:validateModel] Validating RuleModel 'IVRS_Common'
INFO [validation:final] Validation finished
INFO 
INFO --- javagenerator-maven-plugin:6.4.4:generate (default) @ Common ---
INFO [vrgenerator:generate] Done
INFO 
INFO --- wsgenerator-maven-plugin:6.4.4:generate (default) @ Common ---
WARN The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for com.fasterxml.jackson.core:jackson-core:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
INFO [wsdlgenerator:load-models] Loading models
INFO [wsdlgenerator:load-models] Generating webservices
INFO [wsdlgenerator:perform] Including /apps/server/teamserver/data/build/jobs/Master Controller/workspace/Common/buildtarget/generated-resources/
INFO 
INFO --- maven-resources-plugin:2.6:resources (default-resources) @ Common ---
WARN The POM for org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.apache.maven.shared:maven-filtering:jar:1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.codehaus.plexus:plexus-interpolation:jar:1.13 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN Error injecting: org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Update: After adding the missing class to the classpath I have this error

Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.sonatype.plexus.build.incremental.BuildContext.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner;" the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class, org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, org/sonatype/plexus/build/incremental/BuildContext, have different Class objects for the type xt.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner; used in the signature
at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:221)
at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:301)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 14 more

I added <scope>provided</scope> to the plexus-utils dependency in both the maven-filtering pom and the plexus-container-default pom but no resolution for the error

0 个答案:

没有答案