2

我有一个使用 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
4

1 回答 1

3

这里的问题是工件对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>
于 2015-05-19T09:52:51.610 回答