I'm attempting to create a basic maven site using the maven site plugin. So I added this to my pom:
我正在尝试使用maven站点插件创建一个基本的maven站点。我把这个加到pom中
<reporting>
<plugins>
<!--JavaDoc setup-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<defaultAuthor>Leon Blakey</defaultAuthor>
<defaultVersion>${project.version}</defaultVersion>
<links>
<link>http://download.oracle.com/javase/6/docs/api</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
And ran mvn site --errors
运行mvn站点——错误
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pircbotx 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:2.0.1:site (default-site) @ pircbotx ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.688s
[INFO] Finished at: Wed Jan 12 18:08:00 EST 2011
[INFO] Final Memory: 5M/13M
[INFO] ------------------------------------------------------------------------
W:\programming\pircbot-hg>
Hmm, odd that there's no output. So when I check target/site, its empty. The only folders are images/ , css/ , and WEB-INF/ , filled with some generic pictures. No javadoc and no site.
嗯,奇怪的是没有输出。所以当我检查目标/站点时,它是空的。唯一的文件夹是图像/、css/和WEB-INF/,其中填充了一些通用图片。没有javadoc,也没有站点。
This is reproducible with mvn site:site
and mvn org.apache.maven.plugins:maven-site-plugin:2.2:site
(apparently maven only wants to use 2.0.1 by default)
这是mvn站点:site和mvn org. apache.mavenins:maven-site-plugin:2.2:site(显然maven只希望默认使用2.0.1)的再现。
Whats strange is that I can go back to maven 2.2.1 and successfully generate a site. But when I use 3.0.1-RC1 (happens to come with Netbeans), it fails.
奇怪的是,我可以回到maven 2.2.1并成功地生成一个站点。但是当我使用3.1 - rc1(碰巧与Netbeans一起使用)时,它失败了。
What am I doing wrong that would make the site plugin fail in 3.0.1 but not 2.2.1?
我做错了什么,使网站插件在3.0.1而不是2.2.1中失败?
3 个解决方案
#1
12
Perhaps you can try using Maven Site Plugin 3.x. You can do that by adding the following in your pom.xml
也许您可以尝试使用Maven站点插件3.x。您可以通过在您的pom.xml中添加以下内容来实现这一点
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
</plugin>
</plugins>
</build>
#2
8
I was having the same problem. I found a blog post about the topic.
我也有同样的问题。我发现了一篇关于这个话题的博文。
Quoting the blog (emphasis mine):
引用博客(强调我的):
If you have been using the reporting section of the pom.xml file to generate code quality metrics, javadoc reports, and so forth, you may have a little work to do to migrate this feature into Maven 3. Indeed, the reporting and reportSets sections have been deprecated (it won't cause an error with Maven 3, it will just be ignored), and have been replaced by a reportPlugins section in the configuration block of the maven-site-plugin itself.
如果您一直在使用pom的报告部分。要生成代码质量度量、javadoc报告等xml文件,您可能需要做一些工作来将这个特性迁移到Maven 3。事实上,报告和报告集部分已经被弃用(它不会导致Maven 3的错误,它将会被忽略),并且已经被Maven -site-plugin本身的配置块中的reportPlugins部分所取代。
Ignoring the old <reporting>
without any warning about it being deprecated seems a bit rude, but anyway...
无视旧的 <报告> 而不警告它被弃用似乎有点粗鲁,但无论如何……
So you are basically just moving your old reporting plugins into the configuration section of the new maven-site-plugin.
因此,您基本上只是将旧的报告插件移动到新的maven-site-plugin的配置部分。
A section of the maven-plugin-site explains that they removed of all reporting logic from the core of Maven to "decouple the Maven core from Doxia and to allow arbitrary reporting systems to be developed." Makes sense.
Maven -plugin-site的一部分解释说,他们从Maven的核心中删除了所有的报告逻辑,以“将Maven内核与Doxia分离开来,并允许开发任意的报告系统”。是有意义的。
#3
7
Use of the Site Plugin ( http://maven.apache.org/plugins/maven-site-plugin/ ) with Maven 3 finally seems to be resolved. The (non-beta) version has been released, and the ability to use the version 2 style <reporting>
structure in the pom.xml declaration has been added back.
使用Maven 3的站点插件(http://maven.apache.org/plugins/maven-site-plugin/)最终似乎得到了解决。(非beta)版本已经发布,并且能够在pom中使用版本2样式
Although it is (as usual) hard to navigate the substantial but unorganized and overlapping documentation about Maven 3 and the site plugin, one page - http://maven.apache.org/plugins/maven-site-plugin/maven-3.html - states that the old style is now recommended over the new "plugin to site plugin" style:
虽然(和往常一样)很难浏览关于Maven 3和站点插件的大量但没有组织和重叠的文档,但是有一个页面——http://maven.apache.org/plugins/maven-sitesplugin/maven-3.html——声明旧的样式现在比新的“插件到站点插件”样式更值得推荐:
Note: In Maven 3, the new format does not support report plugins configuration inheritance: see MSITE-484. This format was technically necessary to remove reporting logic from Maven 3, but a new inheritance mechanism still needs to be added to Maven 3 to make it as flexible as the old format. So the new format is not ready for direct use for now.
注意:在Maven 3中,新格式不支持报告插件配置继承:参见MSITE-484。从技术上来说,从Maven 3中删除报表逻辑是必要的,但是仍然需要在Maven 3中添加新的继承机制,使其与旧的格式一样灵活。所以新格式目前还不能直接使用。
The example page http://maven.apache.org/plugins/maven-site-plugin/examples/configuring-reports.html for configuring reports doesn't even mention the "new" formatting method.
用于配置报表的示例页面http://maven.apache.org/plugins/maven-sitesplugin/examples/configuring-reports.html甚至没有提到“新的”格式化方法。
Not sure if this is in a "best practice" form, but an example pom reporting section that works for me with a couple of extra reports is as follows; select your own plugins as desired.
不确定这是否是一种“最佳实践”形式,但是下面是一个pom报告部分的示例,它对我来说有一些额外的报告;根据需要选择您自己的插件。
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- Default Site Pages -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
<!-- Java Documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<!-- Source Code Cross-Reference -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
...
</plugins>
</reporting>
As an aside, If you use the m2e plugin in Eclipse to edit your POMs, then you can use code completion in the version section of a plugin to give you a list of its current versions. Very handy.
顺便提一下,如果您使用Eclipse中的m2e插件来编辑pom,那么您可以在插件的version部分中使用代码补全来提供当前版本的列表。非常方便。
#1
12
Perhaps you can try using Maven Site Plugin 3.x. You can do that by adding the following in your pom.xml
也许您可以尝试使用Maven站点插件3.x。您可以通过在您的pom.xml中添加以下内容来实现这一点
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
</plugin>
</plugins>
</build>
#2
8
I was having the same problem. I found a blog post about the topic.
我也有同样的问题。我发现了一篇关于这个话题的博文。
Quoting the blog (emphasis mine):
引用博客(强调我的):
If you have been using the reporting section of the pom.xml file to generate code quality metrics, javadoc reports, and so forth, you may have a little work to do to migrate this feature into Maven 3. Indeed, the reporting and reportSets sections have been deprecated (it won't cause an error with Maven 3, it will just be ignored), and have been replaced by a reportPlugins section in the configuration block of the maven-site-plugin itself.
如果您一直在使用pom的报告部分。要生成代码质量度量、javadoc报告等xml文件,您可能需要做一些工作来将这个特性迁移到Maven 3。事实上,报告和报告集部分已经被弃用(它不会导致Maven 3的错误,它将会被忽略),并且已经被Maven -site-plugin本身的配置块中的reportPlugins部分所取代。
Ignoring the old <reporting>
without any warning about it being deprecated seems a bit rude, but anyway...
无视旧的 <报告> 而不警告它被弃用似乎有点粗鲁,但无论如何……
So you are basically just moving your old reporting plugins into the configuration section of the new maven-site-plugin.
因此,您基本上只是将旧的报告插件移动到新的maven-site-plugin的配置部分。
A section of the maven-plugin-site explains that they removed of all reporting logic from the core of Maven to "decouple the Maven core from Doxia and to allow arbitrary reporting systems to be developed." Makes sense.
Maven -plugin-site的一部分解释说,他们从Maven的核心中删除了所有的报告逻辑,以“将Maven内核与Doxia分离开来,并允许开发任意的报告系统”。是有意义的。
#3
7
Use of the Site Plugin ( http://maven.apache.org/plugins/maven-site-plugin/ ) with Maven 3 finally seems to be resolved. The (non-beta) version has been released, and the ability to use the version 2 style <reporting>
structure in the pom.xml declaration has been added back.
使用Maven 3的站点插件(http://maven.apache.org/plugins/maven-site-plugin/)最终似乎得到了解决。(非beta)版本已经发布,并且能够在pom中使用版本2样式
Although it is (as usual) hard to navigate the substantial but unorganized and overlapping documentation about Maven 3 and the site plugin, one page - http://maven.apache.org/plugins/maven-site-plugin/maven-3.html - states that the old style is now recommended over the new "plugin to site plugin" style:
虽然(和往常一样)很难浏览关于Maven 3和站点插件的大量但没有组织和重叠的文档,但是有一个页面——http://maven.apache.org/plugins/maven-sitesplugin/maven-3.html——声明旧的样式现在比新的“插件到站点插件”样式更值得推荐:
Note: In Maven 3, the new format does not support report plugins configuration inheritance: see MSITE-484. This format was technically necessary to remove reporting logic from Maven 3, but a new inheritance mechanism still needs to be added to Maven 3 to make it as flexible as the old format. So the new format is not ready for direct use for now.
注意:在Maven 3中,新格式不支持报告插件配置继承:参见MSITE-484。从技术上来说,从Maven 3中删除报表逻辑是必要的,但是仍然需要在Maven 3中添加新的继承机制,使其与旧的格式一样灵活。所以新格式目前还不能直接使用。
The example page http://maven.apache.org/plugins/maven-site-plugin/examples/configuring-reports.html for configuring reports doesn't even mention the "new" formatting method.
用于配置报表的示例页面http://maven.apache.org/plugins/maven-sitesplugin/examples/configuring-reports.html甚至没有提到“新的”格式化方法。
Not sure if this is in a "best practice" form, but an example pom reporting section that works for me with a couple of extra reports is as follows; select your own plugins as desired.
不确定这是否是一种“最佳实践”形式,但是下面是一个pom报告部分的示例,它对我来说有一些额外的报告;根据需要选择您自己的插件。
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- Default Site Pages -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
<!-- Java Documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<!-- Source Code Cross-Reference -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
...
</plugins>
</reporting>
As an aside, If you use the m2e plugin in Eclipse to edit your POMs, then you can use code completion in the version section of a plugin to give you a list of its current versions. Very handy.
顺便提一下,如果您使用Eclipse中的m2e插件来编辑pom,那么您可以在插件的version部分中使用代码补全来提供当前版本的列表。非常方便。