Restlet RAML 扩展错误

Restlet RAML extension error

我有一个使用 Restlet 2.3.1 (JSE) 的项目。我们根据 Restlet 网站使用 Maven:

<properties>
  <restlet-version>2.3.1</restlet-version>
</properties>

<repositories>
    <repository>
      <id>maven-restlet</id>
      <name>Public online Restlet repository</name>
      <url>http://maven.restlet.com</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.restlet.jse</groupId>
      <artifactId>org.restlet</artifactId>
      <version>${restlet-version}</version>
    </dependency>
    <dependency>
      <groupId>org.restlet.jse</groupId>
      <artifactId>org.restlet.ext.jackson</artifactId>
      <version>${restlet-version}</version>
    </dependency>
    <dependency>
      <groupId>org.restlet.jse</groupId>
      <artifactId>org.restlet.ext.jetty</artifactId>
      <version>${restlet-version}</version>
    </dependency>
</dependencies>

一切正常,但是当我尝试添加 RAML 扩展时:

<dependency>
  <groupId>org.restlet.jse</groupId>
  <artifactId>org.restlet.ext.raml</artifactId>
  <version>${restlet-version}</version>
</dependency>

我收到以下错误:

ArtifactDescriptorException: Failed to read artifact descriptor for org.raml:raml-parser:jar:0.8.7: 
ArtifactResolutionException: Failure to transfer org.raml:raml-parser:pom:0.8.7 from http://download.java.net/maven/1 was cached in the local repository, resolution will not be reattempted until the update interval of maven1-java has elapsed or updates are forced. 
Original error: Could not transfer artifact org.raml:raml-parser:pom:0.8.7 from/to maven1-java (http://download.java.net/maven/1): No connector available to access repository maven1-java (http://download.java.net/maven/1) of type legacy using the available factories AetherRepositoryConnectorFactory, WagonRepositoryConnectorFactory

这里的问题是 org.restlet.jse:org.restlet.ext.raml 工件依赖于 org.raml:raml-parser:0.8.7 工件。不幸的是,这个工件在您配置 Maven 使用的任何存储库中都不可用(在 Maven Central 中,它仅在版本 0.8.11 中可用)。

您需要的版本在 Mulesoft maven 存储库中可用: http://repository.mulesoft.org/releases/

将以下存储库定义添加到您的 pom 应该可以解决您的问题:

<repository>
    <id>mulesoft-releases</id>
    <name>MuleSoft Repository</name>
    <url>http://repository.mulesoft.org/releases/</url>
    <layout>default</layout>
</repository>

更新

如果像 David 所建议的那样,您想使用 0.8.11 版本,那么您可以简单地修改您的依赖项,而不是添加 Mulesoft 存储库,如下所示:

<dependencies>
    <dependency>
        <groupId>org.restlet.jse</groupId>
        <artifactId>org.restlet.ext.raml</artifactId>
        <version>${restlet-version}</version>
        <exclusions>
            <!-- exclude transitive dependency (version 0.8.7) -->
            <exclusion>
                <groupId>org.raml</groupId>
                <artifactId>raml-parser</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- explicitly define dependency to version 0.8.11 -->
    <dependency>
        <groupId>org.raml</groupId>
        <artifactId>raml-parser</artifactId>
        <version>0.8.11</version>
    </dependency>

    <!-- other dependencies -->
</dependencies>