7

我已迁移到 maven 3.0.3,但无法构建 maven 站点。事实上,我的项目使用了一个不提供任何站点描述符作为工件的外部父 pom。

1-即使父母不提供 site.xml 有没有办法生成 Maven 网站?我不能让它工作。“mvn site”命令仍然在尝试下载具有以下错误的父站点的 site.xml 时崩溃(ArtifactResolutionException:无法找到站点描述符......)

2-我们如何在 Maven 存储库上安装或部署 site.xml。我尝试在我的父 pom 中添加以下 xml,但它没有使用 mvn install 命令在我的本地 repo 中安装任何东西。我的项目中有一个 src/site/site.xml,我的项目是 pom 类型的项目 maven-site-plugin attach-descriptor attach-descriptor

更新

不,它不起作用在我的 pom 中,我有

<url>${site_url_pattern}</url>

<distributionManagement>
<site>
<id>test</id>
<url>file://${baseDir}../maven-site</url>
</site>
</distributionManagement>

在插件管理中我放了

<plugin>
<!-- Site plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<chmod>true</chmod>
<inputEncoding>${encoding}</inputEncoding>
<outputEncoding>${encoding}</outputEncoding>
</configuration>
</plugin>

在我放的插件中

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<locales>en</locales>
<reportPlugins>
<!-- Manage site info part creation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin
</artifactId>
<version>2.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
<offline>true</offline>
</configuration>
<reports>
<report>cim</report>
<!-- Dependencies report are consuming resources set MAVEN_OPTS=-Xmx1024m if java heap <report>dependencies</report> <report>dependencies-convergence</report> <report>dependencies-management</report> -->
<report>index</report>
<report>issue-tracking</report>
<!-- pb time generation on licence report <report>license</report> -->
<report>mailing-list</report>
<report>plugin-management</report>
<report>project-team</report>
<report>scm</report>
<report>summary</report>
</reports>
</plugin>
</reportPlugins>
</configuration>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
</plugin>

我在同一个项目中有一个 src/site/site.xml

当我做 mvn site 我还有

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:si
te (default-site) on project ner-delivery: SiteToolException: The site descripto
r cannot be resolved from the repository: ArtifactResolutionException: Unable to
 locate site descriptor: Could not transfer artifact com.sopragroup.evolan:evola
n-framework-superpom:xml:site_en:6.14.2 from/to Artifactory (http://pdtinteg.ptx
.fr.sopra/artifactory/repo): Access denied to: http://pdtinteg.ptx.fr.sopra/arti
factory/repo/com/sopragroup/evolan/evolan-framework-superpom/6.14.2/evolan-frame
work-superpom-6.14.2-site_en.xml
[ERROR] com.sopragroup.evolan:evolan-framework-superpom:xml:6.14.2

如果我在我的本地仓库中手动放置一个 evola-framework-superpom-6.14.2-site_en.xml 它正在工作,但这不是一个真正的解决方案

4

1 回答 1

2
  1. 在你的 pom 中显式配置 maven-site-plugin 3.0:

      <pluginManagement>
        <plugin>
               <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <chmod>true</chmod>
                    <inputEncoding>UTF-8</inputEncoding>
                    <outputEncoding>UTF-8</outputEncoding>
                </configuration>
            </plugin>
        </pluginManagement>
    
  2. 添加一个 url 和一个 distributionManagement 元素,告诉您计划在哪里部署它。

  3. 添加包含您需要的内容的 src/site/site.xml。

如果你的父母没有这些,它会起作用。

于 2011-09-13T19:26:28.367 回答