我有小型 Maven 项目。我正在尝试通过 maven-site-plugin 添加生成站点,但它不起作用。当我构建这个项目时,我收到以下错误:
[错误] 无法在项目 server-wms-product 上执行目标 org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site):SiteToolException:无法从存储库解析站点描述符:ArtifactResolutionException : 无法定位站点描述符: 无法将 Artifact [PARENT-PROJECT]:xml:site_en:1.0.141.1 从/到 eclipse (http://maven.eclipse.org/nexus/content/repositories/testing/): 连接到 http://maven.eclipse.org拒绝
我的项目是其他项目的扩展,所以在我的 pom.xml 中设置了不是我的父项目,我不能在那里添加站点配置。
那么有没有机会在站点生成中跳过检查父项目的站点?
我的 pom.xml 看起来像这样:
<project>
<parent>
<artifactId>base-server-product</artifactId>
<groupId>XXXXXXXXXXXx</groupId>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</project>
当然,我在 src/site 中有 site.xml 文件。
最佳答案
配置attaching the site descriptor到父 pom 中的 Artifact 。
<project>
<artifactId>base-server-product</artifactId>
<groupId>XXXXXXXXXXXx</groupId>
<version>1.0</version>
...
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
在 maven 3 中,核心功能已与站点生成分离。您可以找到原因 here .如果要从子模块引用父模块的站点,则必须将 site.xml 附加到已部署的 Artifact 。
关于maven - 如何避免在 maven-site-plugin 中检查父项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23597456/