无法在com.itextpdf:itext7-core:pom:RELEASE处收集依赖项

问题描述 投票:1回答:1

我正在尝试使用itextpdf库创建pdf报告。按照the official documentation中的指示,我确实在pom.xml中添加了以下依赖项:

<properties>
   <itext.version>RELEASE</itext.version>
</properties>
<dependencies>
    <!-- add all iText 7 modules -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext7-core</artifactId>
        <version>${itext.version}</version>
        <type>pom</type>
    </dependency>
</dependencies>

为了确保所有内容都整洁干净,我删除了.m2 / repository目录$rm -R .m2/repository,然后在项目主目录中确实运行了$mvn clean compile。然后出现以下错误:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project business-project: Could not resolve dependencies for project myproject:business-project:jar:1.1-SNAPSHOT: Failed to collect dependencies at com.itextpdf:itext7-core:pom:RELEASE
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:269)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:147)
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:248)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:202)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project myproject:business-project:jar:1.1-SNAPSHOT: Failed to collect dependencies at com.itextpdf:itext7-core:pom:RELEASE

[这是$mvn dependency:tree的输出:

[INFO] -------------------< myproject:business-project >--------------------
[INFO] Building Business Layer 1.1-SNAPSHOT                        [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for myproject 1.1-SNAPSHOT:
[INFO] 
[INFO] my project ......................................... SUCCESS [  0.921 s]
[INFO] DB .......................................... SUCCESS [  0.108 s]
[INFO] Business Layer .............................. FAILURE [  0.234 s]
[INFO] Web Application ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.662 s
[INFO] Finished at: 2020-02-21T20:07:06+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project business-project: Could not resolve dependencies for project myproject:business-project:jar:1.1-SNAPSHOT: Failed to collect dependencies at com.itextpdf:itext7-core:pom:RELEASE: Failed to read artifact descriptor for com.itextpdf:itext7-core:pom:RELEASE: Failed to resolve version for com.itextpdf:itext7-core:pom:RELEASE: Could not find metadata com.itextpdf:itext7-core/maven-metadata.xml in local (/Users/MyComputer/.m2/repository) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :business-project

正在运行$mvn -v,我得到:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3/libexec
Java version: 1.8.0_101, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"

在我的settings.xml中配置的我的nexus服务器:

<mirrors>

        <mirror>
                                               <id>public</id>
                                               <mirrorOf>*</mirrorOf>
                                               <name>Central Repositories of internal repository manager Nexus</name>
                                                <url>http://nexus-server:8081/nexus/content/repositories/public</url>
                               </mirror>
    </mirrors>

我该如何解决此问题?谢谢。

java maven itext
1个回答
2
投票

我不确定您要做什么,但是基于给定的信息,我想您正在尝试将pom文件导入为所谓的BOM (Bill Of Material)。您遇到的问题是,您试图将pom类型定义为将不起作用的依赖项,原因是您无法在类路径中放置任何内容。此外,给定的版本是defined via the property does simply not exist in Central repository

© www.soinside.com 2019 - 2024. All rights reserved.