这是Maven 3.0。我正在创建一个新项目:
mvn archetype:create
然后我正在创建一个文件site/site.xml
:
<project name="foo">
<body>
<menu name="Overview">
<item name="Introduction" href="index.html" />
</menu>
<menu ref="reports" />
</body>
</project>
然后我要向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>
然后我运行mvn site
并说"BUILD SUCCESS"
。但我没有在项目网站上看到任何报告(报告菜单项不存在)。我做错了什么?
答案 0 :(得分:19)
Maven 3报告is different。
[...]
<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>
[...]
答案 1 :(得分:0)
这个pom有效(即使你没有定义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>
答案 2 :(得分:-1)
是的maven 3报告不同。提示:对于maven 3,你可以在版本3.0-beta-2中使用maven-site-plugin(网站插件版本3.0-beta-3运行在我的计算机上出现错误,使用maven 3.0-beta-3)。这将是正常的。但对于报告:更改报告或更改日志我必须使用旧的报告方式。
这是我的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>