Develop your own Maven plug-in 6: Use your own report-plugin

Source: Internet
Author: User

There is an article on the Internet: http://docs.codehaus.org/display/MAVENUSER/Write+your+own+report+plugin

I talked about some basic operations, but the example is really simple for people familiar with report-plugin development, and it is a little complicated for people who are not familiar with it. So the example is not good.

Although the previous article is simple, the example is simple and easy to understand.

Use this plug-in with another Maven program.

Pom. XML is used as follows:

  <build>    <plugins>      <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-site-plugin</artifactId><version>3.0</version><configuration>  <reportPlugins>    <plugin>      <groupId>org.freebird</groupId>      <artifactId>myreport</artifactId>      <version>1.0-SNAPSHOT</version>    </plugin>  </reportPlugins></configuration>      </plugin>    </plugins>  </build>

Run the MVN clean package site command and check the file in the target directory:

chenshu@ubuntu:~/NetBeansProjects/mavenproject1/target$ tree.└── site    ├── css    │   ├── maven-base.css    │   ├── maven-theme.css    │   ├── print.css    │   └── site.css    ├── images    │   ├── collapsed.gif    │   ├── expanded.gif    │   ├── external.png    │   ├── icon_error_sml.gif    │   ├── icon_info_sml.gif    │   ├── icon_success_sml.gif    │   ├── icon_warning_sml.gif    │   ├── logos    │   │   ├── build-by-maven-black.png    │   │   ├── build-by-maven-white.png    │   │   └── maven-feather.png    │   └── newwindow.png    ├── myreport-output.html    └── project-reports.html4 directories, 17 files

The name of the myreport-output.html file is obtained by calling my report1.getoutputname () method by MVN site.

Open the target/site/project-report.html file in a browser and you will see:

Project name: mavenproject1

The myreport-name returned by report1.getname appears in the document column on the left and overview.

The myreport-description returned by report1.getdescription appears in the overview description.

If you click the myreport-name link on the left, you will see hello World.

However, the outputdirecotry setting seems useless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.