Javadoc や テストレポートについては → Maven プロジェクトレポートの作成
MavenSiteExam/ ├── LICENSE ├── README.md ├── nbactions.xml ├── pom.xml ├── sub1 │ ├── pom.xml │ └── src │ ├── main │ │ └── java │ │ └── com │ │ └── example │ │ └── sub1 │ │ └── Sub1App.java │ └── test │ └── java │ └── com │ └── example │ └── sub1 │ └── test │ └── Sub1AppTest.java └── sub2 ├── pom.xml └── src ├── main │ ├── java │ │ └── com │ │ └── example │ │ └── sub2 │ │ └── Sub2App.java │ └── resources └── test └── java └── com └── example └── sub2 └── test └── Sub2AppTest.java 27 directories, 10 files
<?xml version="1.0" encoding="UTF-8"?> <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>com.example</groupId> <artifactId>multi</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>sub1</module> <module>sub2</module> </modules> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <!-- Project Site --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>3.6</version> </plugin> <!-- Make JAR OSGi Bundle Ready --> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>3.2.0</version> <extensions>true</extensions> <configuration> <instructions> <Embed-Dependency>*;scope=compile</Embed-Dependency> <Embed-Transitive>true</Embed-Transitive> <Export-Package> com.example.sub1.*, com.example.sub2.* </Export-Package> <Import-Package> !com.sun.*, !junit.*, * </Import-Package> </instructions> </configuration> </plugin> <!-- Compiler --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> </configuration> </plugin> <!-- Coverage --> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.8</version> <executions> <execution> <id>prepare-agent</id> <phase>test-compile</phase> <goals> <goal>prepare-agent</goal> </goals> <configuration> <propertyName>jacocoArgs</propertyName> <includes> <include>*</include> </includes> </configuration> </execution> </executions> </plugin> </plugins> <pluginManagement> <plugins> <plugin> <!-- update pom.xml : $ mvn versions:use-latest-versions show updatables : $ mvn versions:display-dependency-updates --> <groupId>org.codehaus.mojo</groupId> <artifactId>versions-maven-plugin</artifactId> <version>2.3</version> </plugin> </plugins> </pluginManagement> </build> <dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.16.12</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope> </dependency> </dependencies> <reporting> <excludeDefaults>true</excludeDefaults> <outputDirectory>${project.build.directory}/site</outputDirectory> <plugins> <!-- Project Info --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.9</version> <reportSets> <reportSet> <reports> <report>index</report> <report>dependencies</report> <report>dependency-convergence</report> <report>dependency-management</report> <report>plugins</report> <report>plugin-management</report> <report>cim</report> <!-- <report>issue-tracking</report> <report>license</report> <report>mailing-list</report> <report>project-team</report> <report>scm</report> <report>summary</report> --> </reports> </reportSet> </reportSets> </plugin> <!-- Javadoc --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.10.4</version> <configuration> <docencoding>${project.build.sourceEncoding}</docencoding> <charset>${project.build.sourceEncoding}</charset> <encoding>${project.build.sourceEncoding}</encoding> <bottom>Copyright &copy; 2017 Snail Co. LTD.All Rights Reserved.</bottom> </configuration> </plugin> <!-- Source code --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> <version>2.5</version> </plugin> <!-- Checkstyle --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.17</version> <configuration> <!-- <configLocation>src/conf/Checkstyle_MyRule.xml</configLocation> --> <excludes>**/test/*.java</excludes> </configuration> </plugin> <!-- Findbugs --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>3.0.4</version> </plugin> <!-- PMD --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>3.7</version> </plugin> <!-- Test --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.19.1</version> <configuration> <forkCount>1</forkCount> <reuseForks>true</reuseForks> <argLine>${jacocoArgs} -Xmx768m</argLine> <!-- you will be unhappy if trimStackTrace is true when test fails during integration test and system test phase --> <trimStackTrace>false</trimStackTrace> </configuration> </plugin> <!-- Coverage --> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.8</version> </plugin> <!-- NCSS (Code count) --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>javancss-maven-plugin</artifactId> <version>2.1</version> </plugin> <!-- TODO --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>taglist-maven-plugin</artifactId> <version>2.4</version> </plugin> </plugins> </reporting> <distributionManagement> <site> <id>${project.artifactId}-site</id> <url>${project.baseUri}</url> </site> </distributionManagement> </project>
<?xml version="1.0" encoding="UTF-8"?> <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> <parent> <groupId>com.example</groupId> <artifactId>multi</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>sub1</artifactId> <packaging>bundle</packaging> <dependencies> <dependency> <groupId>${project.groupId}</groupId> <artifactId>sub2</artifactId> <version>${project.version}</version> </dependency> </dependencies> </project>
<?xml version="1.0" encoding="UTF-8"?> <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> <parent> <groupId>com.example</groupId> <artifactId>multi</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>sub2</artifactId> <packaging>bundle</packaging> </project>
<distributionManagement> <site> <id>${project.artifactId}-site</id> <url>${project.baseUri}</url> </site> </distributionManagement>をしている。site:stage で、親側の target/ に、子プロジェクトの site report が集められてる
$ mvn clean jacoco:prepare-agent test site $ mvn javancss:report // re-run javancss:report to aggreage line counts. $ mvn site:stage // gather site htmls to parent projectこれだと、完璧な site report が得られる。ただし、親側の site report に Jacoco のカバレッジが集計されない (対策方法はないようだ)
$ mvn clean jacoco:prepare-agent test site site:stage親側の site report に諸々集計されない。ただし子側には集計される。また、上記コマンドを Jenkins で実行した場合には、Jenkins は諸々集計してくれる
/src/site/site.xml | サイトの大枠(メニューやヘッダなど)を設定します |
/src/site/resources/images | イメージ |
/src/site/apt | 各ページの生成元(apt形式)を置きます |
/src/site/fml | 各ページの生成元(fml形式)を置きます |
/src/site/xdoc | 各ページの生成元(xdoc形式)を置きます |
<?xml version="1.0" encoding="UTF-8"?> <project name="${project.name}"> <bannerLeft> <name>${project.name}</name> <src>./images/ipmsg.png</src> <href>http://hondou.homends.org/ipmaglet/</href> </bannerLeft> <body> <links> <item name="${project.name}" href="${project.url}"/> <item name="IPMSG" href="http://www.ipmsg.org/" /> <item name="Project Amateras " href="https://sourceforge.jp/projects/amateras/" /> </links> <menu name="Menu"> <item name="Introduction" href="./index.html" /> <item name="License" href="./license.html" /> <item name="APT Example" href="./example.html" /> </menu> <menu ref="parent" /> <menu ref="modules" /> <menu ref="reports" /> </body> </project>
<?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.snail</groupId> <artifactId>Some Artifact</artifactId> <packaging>jar</packaging> <name>My Application</name> <version>1.0-SNAPSHOT</version> <description>プロジェクトの概要</description> <url>プロジェクトのURL</url> <prerequisites> <maven>2.0</maven> </prerequisites> <issueManagement> <system>案件管理システム</system> <url>案件管理システムのURL</url> </issueManagement> <ciManagement> <system>継続的結合システム(必要があればnotifierを定義可能)</system> <url>継続的結合システムのURL</url> <notifiers> <notifier> <address>メールアドレス</address> <sendOnError>true</sendOnError> <sendOnFailure>true</sendOnFailure> <sendOnSuccess>false</sendOnSuccess> <sendOnWarning>false</sendOnWarning> <type>Mail</type> </notifier> <notifier> <address>RSSのURL</address> <sendOnError>true</sendOnError> <sendOnFailure>true</sendOnFailure> <sendOnSuccess>true</sendOnSuccess> <sendOnWarning>true</sendOnWarning> <type>RSS</type> </notifier> </notifiers> </ciManagement> <inceptionYear>2009</inceptionYear> <mailingLists> <mailingList> <name>プロジェクトメーリングリスト</name> <subscribe>参加申込受付アドレス@foo.com</subscribe> <unsubscribe>配信停止申し込みアドレス@foo.com</unsubscribe> <post>投稿用メールアドレス@foo.com</post> <archive>メーリングリスト過去履歴確認サイトURL</archive> <otherArchives> <otherArchive>メーリングリスト過去履歴確認サイトURL(予備1)</otherArchive> <otherArchive>メーリングリスト過去履歴確認サイトURL(予備2)</otherArchive> </otherArchives> </mailingList> </mailingLists> <developers> <developer> <id>001</id> <name>おれ</name> <email>foo@bar.com</email> <url>http://www.foor.bar.com/</url> <organization>なんでも課</organization> <roles> <role>あれもやる</role> <role>これもやる</role> <role>それもやる</role> </roles> <timezone>+9</timezone> </developer> </developers> <!-- 必要ならここに contributor を定義する --> <licenses> <license> <name>Apache License 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.html<url> <comments>上記のページがプロジェクトページに取り込まれます(日本語は文字化けする)</comments> </license> </licenses> <scm> <url>SCMのURL</url> <tag>安定バージョンのTag</tag> <connection>scm:svn:http://username:password@server_name/path_to_repository</connection> <developerConnection>scm:svn:http://username:password@server_name/path_to_repository</developerConnection> </scm> <build> ...(以下略)...
------ Title(apt練習帳) ------ Author(ほんどう) ------ Date(何年何月何日) 文章は、先頭にスペースを空けます。 APT上では改行してもHTML上では連続した文章になります。 空の改行行を入れると別のパラグラフになります。 HTML上で改行する場合には、\ 行末に\\を書けば良いはずですが・・・うまくいかないようです。 行頭から書き始めるとセクションになります * サブセクションは、先頭に*を書きます ** サブ-サブセクションは、先頭に**を書きます *** サブ-サブ-サブセクションは、先頭に***を書きます **** サブ-サブ-サブ-サブセクションは、先頭に****を書きます * リストはスペースで字下げしたあとに*を書きます * リストの中に文章を含めることができます 空の改行を入れて、字下げした行はリスト配下の文書になります * 親リストからさらにスペースで字下げして*を書くとサブリストになります * サブリストの2項目目 * リストを終えるためには字下げした[]を書きます [] +------------------------------------------+ 文書を枠で囲むにはこんな感じにします 枠の中は<PRE>タグで囲まれています +------------------------------------------+ ------------------------------------------ +--の代わりに---を使うこともできます 枠の中は<PRE>タグで囲まれています ------------------------------------------ [[1]] リストに番号をつける場合 [[A]] Numbered item A. [[a]] Numbered item a. [[b]] Numbered item b. [[B]] Numbered item B. [[2]] Numbered item 2. [[I]] Numbered item A. [[i]] Numbered item a. [[ii]] Numbered item b. [[II]] Numbered item B. [] [重要なポイント1] 1,I,A,i,a以外がリストに使われると黄色い四角で囲われます. [重要なポイント2] . [] 画像 [./images/ipmsg.png] 画像の説明文はここに書きます 表 *------------*--------------+----------------: | 右上が*なら| 右上が+なら | 右上が:なら | | 中央寄せ | 左寄せ | 右寄せ | *------------*--------------+----------------: | cell 2,1 | cell 2,2 | cell 2,3 | *------------*--------------+----------------: テーブルの表題はテーブル直下に書きます テーブルの左端と右端の"|"はなくてもいい。またテーブル表題(Caption)も無くてもいい。 *-----*------* cell | cell *-----*------* cell | cell *-----*------* 水平線 水平線(\<HR\>)は = を 3つ以上連続で書く ======================================================================= 字体 <Italic> font. <<Bold>> font. <<<Monospaced>>> font. リンク * アンカー {anchor}. * アンカーへのリンク {{anchor}}. (現時点では、上手く生成されない(URLの先頭の#が抜けている)) * URL直接指定リンク {{http://www.pixware.fr}}. * 文字列をリンクにする {{{http://www.pixware.fr}Pixware home page}}. APTで制御文字として使われている文字の表示 Escaped special characters: \~, \=, \-, \+, \*, \[, \], \<, \>, \{, \}, \\. Copyright symbol: \251, \xA9, \u00a9. コメントアウト ~~早くこのプロジェクトから抜けたい・・・(この文章はHTMLには出力されない)
<html> <head> <title>ipmsglet - Title(apt練習帳)</title> <style type="text/css" media="all"> @import url("./css/maven-base.css"); @import url("./css/maven-theme.css"); @import url("./css/site.css"); </style> <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> <meta name="author" content="Author(ほんどう)" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body class="composite">あれ?dateはどこ行った?