2

在尝试找到解决方案 2 小时后,我完全迷失了方向。

对于我的项目,我需要发音 ( http://enunciate.codehaus.org/ ) 为应用程序的 RESTFul api 生成文档。之前使用 1.28 版本的 maven-enunciate-plugin 效果很好,但是突然我在执行 enunciate 的 maven 目标时在插件中遇到了 NullPointerException (但该异常是另一个需要整理的故事..)

无论如何,我看到 1.29 有更新,所以我想我试试看。

在 maven 构建过程中发音的正常配置基本上是这样的:

         <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>1.29</version>
            <executions>
                <execution>
                    <goals>
                        <goal>docs</goal>
                    </goals>
                    <configuration>                            
                        <docsDir>${project.build.directory}/docs</docsDir>
                        <configFile>enunciate.xml</configFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>

遗憾的是 1.29 目前似乎不在 maven 中央存储库中,但添加了一个手动依赖项和存储库,如下所示:

<repositories>
    <repository>
        <id>opencast-public</id>
        <url>http://repository.opencastproject.org/nexus/content/repositories/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>maven-enunciate-plugin</artifactId>
        <version>1.29</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

实际上将 1.29 下载到我的本地 m2-repo 中(我可以看到所有文件......)。无论如何,一旦我尝试使用上述插件,maven 将无法正确执行,但会退出:

插件 org.codehaus.enunciate:maven-enunciate-plugin:1.29 或其依赖项之一无法解析:无法读取 org.codehaus.enunciate:maven-enunciate-plugin:jar:1.29 的工件描述符:找不到 org http://repo.maven.apache.org/maven2中的 .codehaus.enunciate:maven-enunciate-plugin:pom:1.29被缓存在本地仓库中,直到 Central 的更新间隔已过或更新后才会重新尝试解析被迫 -> [帮助 1]

为什么 maven 没有使用正确下载的依赖项?

任何帮助都非常感谢,因为我已经浪费了很多时间来摆弄它。

4

1 回答 1

3

我自己也遇到了这个。您需要确保将存储库添加到 pluginRepositories 块而不是 repositories 块中。

<pluginRepositories>
    <pluginRepository>
        <id>opencast-public</id>
        <url>http://repository.opencastproject.org/nexus/content/repositories/public/</url>
    </pluginRepository>
</pluginRepositories>
于 2014-06-27T18:54:54.940 回答