解決策を見つけました。それは少しハックですが、それは私のために働く。
アーティファクト(sources.jar)を取得し、展開して、javadocプラグインをソースディレクトリに指定したいと思っています。
このソリューションは、私は後で詳しく説明します4つの貴様の部分があります
- 私は
- を含めるすべての成果物でsources.jarsを生成開梱したものsources.jarsを
- javadoc-pluginを展開したソースに指定してJavadocを生成する
- 生成されたapidocsをzipファイルにパッケージ化します。
次のように
1.私はあなたがのmaven-ソース・プラグインを使用する必要がsources.jarsを生成するには
を含めるすべての成果物でsources.jarsを生成します:より詳細に今
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>bundle-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
これは、apidocsに含めるすべてのプロジェクト/モジュール/成果物で行う必要があります。
2.開梱あなたのものsources.jars
はあなたがsources.jarファイルを解凍するには、次のプラグインを追加する必要がjavadocを生成するために使用するのpom.xml。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-artifact-sources</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId><!-- your artifact here --></artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/unpack_sources</outputDirectory>
</configuration>
</execution>
<!-- add more unpack-executions here -->
</executions>
</plugin>
好きなだけアンパック実行ブロックを追加できます。
3.今アンパックソース
トリッキーな部分へのjavadoc-プラグインを指していることにより、Javadocを生成します。 javadoc-pluginにソースファイルを探す場所を知らせます。インポートされた定義は<sourcepath>
の定義です。このセクションでは、我々は
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<sourcepath>${project.build.directory}/unpack_sources</sourcepath>
</configuration>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
あなたがあなたのtarget
フォルダ内site
フォルダになってしまいます。この時点でmvn clean install
呼び出すステップ2でソースを解凍したフォルダを定義します。このサイトのフォルダには、あなたのapidocsがあります。しかし、これを輝かしくするために、私たちはapidocsをzipアーカイブにまとめたいと思っています。
4.パッケージあなたがmaven-assembly-plugin
、余分なアセンブリ・ファイルを使用する必要がドキュメントを組み立てるためにzipファイルで生成されたapidocs
。あなたのポンポン内部 まずプラグインdefintion:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>docs-assembly</id>
<phase>package</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assemble.xml</descriptor>
</descriptors>
</configuration>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
assemble.xml:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>${project.build.finalName}</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/site/apidocs</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>