Мне понадобился пакет javax.xml для моего нового проекта. Я выполнил поиск в mvnrepository.com и нашел one :
<!-- https://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>2.0_EA1</version>
</dependency>
Полагаю, первая строка комментария - это репозиторий пакетов. Пожалуйста, поправьте меня, если я ошибаюсь. Я добавил следующие разделы в свой pom.xml
:
<repositories>
<repository>
<id>repo1</id>
<name>Repo 1</name>
<url>https://mvnrepository.com/artifact/javax.xml/jaxrpc-api</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>2.0_EA1</version>
</dependency>
</dependencies>
Но, похоже, я ошибся адресом maven.
mvn compile
принесла ошибка:
[ERROR] Failed to execute goal on project test-xpath: Could not resolve dependencies for project com.kkk:test-xpath:jar:0.0.1-SNAPSHOT: Failure to find javax.xml:jaxrpc-api:jar:2.0_EA1 in https://mvnrepository.com/artifact/javax.xml/jaxrpc-api was cached in the local repository, resolution will not be reattempted until the update interval of repo1 has elapsed or updates are forced -> [Help 1]
Что я сделал не так и как это исправить?
UPD
После удаления репозитория я получил ошибку:
Failed to execute goal on project test-xpath: Could not resolve dependencies for project com.kkk:test-xpath:jar:0.0.1-SNAPSHOT: Failure to find javax.xml:jaxrpc-api:jar:2.0_EA1 in https://mvnrepository.com/artifact/javax.xml/jaxrpc-api was cached in the local repository, resolution will not be reattempted until the update interval of repo1 has elapsed or updates are forced -> [Help 1]
UPD2
Я узнал, что я должен добавить репозиторий Spring в мои зависимости:
<repositories>
<repository>
<id>repo1</id>
<name>Repo 1</name>
<url>http://repo.spring.io/plugins-release/</url>
</repository>
</repositories>
Я удалил .m2\repository\javax
и сделал maven clean
maven compile
выданная ошибка:
Downloading from repo1: http://repo.spring.io/plugins-release/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.pom
Downloaded from repo1: http://repo.spring.io/plugins-release/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.pom (395 B at 736 B/s)
Downloading from repo1: http://repo.spring.io/plugins-release/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.jar
Downloading from central: https://repo.maven.apache.org/maven2/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.767 s
[INFO] Finished at: 2018-11-07T14:17:38+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project test-xpath: Could not resolve dependencies for project com.kkk:test-xpath:jar:0.0.1-SNAPSHOT: Could not find artifact javax.xml:jaxrpc-api:jar:2.0_EA1 in repo1 (http://repo.spring.io/plugins-release/), try downloading from https://jax-rpc.dev.java.net/jaxrpc20-ea/ -> [Help 1]
В случае, если я делаю то же действие без <repository>
в моем pom.xml и делаю maven compile
, у меня та же ошибка, но он пытается загрузить pom с maven.repo
.
Downloading from central: https://repo.maven.apache.org/maven2/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.pom (395 B at 987 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/javax/xml/jaxrpc-api/2.0_EA1/jaxrpc-api-2.0_EA1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.180 s
[INFO] Finished at: 2018-11-07T14:31:44+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project test-xpath: Could not resolve dependencies for project com.kpv:test-xpath:jar:0.0.1-SNAPSHOT: Could not find artifact javax.xml:jaxrpc-api:jar:2.0_EA1 in central (https://repo.maven.apache.org/maven2), try downloading from https://jax-rpc.dev.java.net/jaxrpc20-ea/ -> [Help 1]