Я пытаюсь создать отчет в формате PDF с использованием библиотеки itextpdf. Как указано в официальной документации , я добавил в свой 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 directory $rm -R .m2/repository
и работал после wwwards $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"
Мой Сервер Nexus настроен в моих настройках. xml:
<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>
Как мне решить эту проблему, пожалуйста? Спасибо.