3

我无法在 linux 服务器上使用 maven 存储库构建项目。我在我的 Windows 电脑上使用相同的存储库,并且能够构建它。

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 依赖于 plexus-container 和 plexus-interpolation。失踪的班级在

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

用于 maven 过滤的 pom 似乎具有错误的相对路径,即使它在 Windows 中工作也是如此。

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

它应该是

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

我已经查看了其他一些相关问题,为什么我会因为缺少 dependency.version 而得到无效的 pom,尽管版本是受管理的?<name>的POM 无效,传递依赖项(如果有)将不可用。我尝试mvn install在包含 maven-filtering pom 及其父目录的目录中运行,但我得到了

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

我尝试mvn dependency:tree在这两个相同的目录中执行,我得到了

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

我进入 maven-dependency-plugin:2.8 的 pom 并将包装从 maven-plugin 更改为 pom,但我仍然收到该错误。当我对 pom 进行更改时,我使用此命令

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

有时我只是更改服务器上的 pom 而不执行部署命令,当我在浏览器中查看存储库时会反映更改,所以我不确定它是否有所作为。

编辑:从构建中添加更多控制台输出

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;

更新: 将缺少的类添加到类路径后,出现此错误

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

<scope>provided</scope>在 maven-filtering pom 和 plexus-container-default pom 中添加了 plexus-utils 依赖项,但没有解决该错误

4

0 回答 0