Question

Il est Maven 3.0. Je crée un nouveau projet:

mvn archetype:create

Alors je crée un fichier site/site.xml:

<project name="foo">
  <body>
    <menu name="Overview">
      <item name="Introduction" href="index.html" />
    </menu>
    <menu ref="reports" />
  </body>
</project>

Alors j'ajoute un plugin de rapport à pom.xml:

<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-project-info-reports-plugin</artifactId>
      <version>2.1.1</version>
    </plugin>
  </plugins>
</reporting>

Alors je lance mvn site et il dit "BUILD SUCCESS". Mais je ne vois pas de rapports dans le site du projet (élément de menu rapports ne sont pas là). Qu'est-ce que je fais mal?

Était-ce utile?

La solution

Maven 3 rapports est différent.

[...]
<build>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.0-beta-2</version>
    <configuration>
      <reportPlugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>2.2</version>
          <reports>
            <report>cim</report>
            <report>issue-tracking</report>
          </reports>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.2</version>
        </plugin>
      </reportPlugins>
    </configuration>
  </plugin>
</build>
[...]

Autres conseils

Cela fonctionne pom (même si vous ne définissez pas le fichier site.xml)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>it.cucchiara</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>test</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.1.1</version>
            </plugin>
        </plugins>
    </reporting>
</project>

oui Maven 3 rapports est différent. Astuce: Pour Maven 3 vous pourriez vous utiliser le maven site-plugin dans la version 3.0 bêta-2 (site de version plug-in 3.0-beta-3 run est dans une erreur sur mon ordinateur avec Maven 3.0-beta-3). Ce sera beau travail. Mais pour les rapports: rapport de changement ou changelog je dois être utiliser l'ancienne manière de rendre compte supplémentaire.

Voici les parties intéressantes de ma pom.xml.

        <build>
        :
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.0-beta-2</version>
          <executions>
            <execution>
            <id>createsite</id>
            <phase>package</phase>
            <goals>
                <goal>site</goal>
            </goals>
            <configuration>
                <reportPlugins>
                    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.2</version>
                        <reportSets>
                        <reportSet>
                        <reports>
                          <report>dependencies</report>
                          <report>license</report>
                          <report>scm</report>
                          <report>project-team</report>
                        </reports>
                        </reportSet>
                        </reportSets>
                    </plugin>
                </reportPlugins>
            </configuration>
            </execution>
         </executions>
      </plugin>
      :
    <build>

    <reporting>
      <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.3</version>
        <reportSets>
        <reportSet>
        <reports>
          <report>changes-report</report>
        </reports>
        </reportSet>
        </reportSets>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-changelog-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        </plugins>
    </reporting>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top