Maven 3:为定义的工件生成Javadoc
我只想从专用的docs项目中为我的项目的某些工件生成javadocs 这意味着,我希望有一个独立的项目,称为“文档”,例如。在docs/pom.xml中,我想定义应该包含在生成的javadocs中的工件 到目前为止,我了解到我必须为我想要包含的项目生成一个单独的sources.jar。但我不知道如何继续下去 目前我只能想象两种方法:Maven 3:为定义的工件生成Javadoc,maven,javadoc,maven-3,maven-javadoc-plugin,Maven,Javadoc,Maven 3,Maven Javadoc Plugin,我只想从专用的docs项目中为我的项目的某些工件生成javadocs 这意味着,我希望有一个独立的项目,称为“文档”,例如。在docs/pom.xml中,我想定义应该包含在生成的javadocs中的工件 到目前为止,我了解到我必须为我想要包含的项目生成一个单独的sources.jar。但我不知道如何继续下去 目前我只能想象两种方法: 获取我想要包含的工件(sources.jar),解压它们,并以某种方式将Javadoc插件指向源目录 将我感兴趣的工件定义为依赖项,并使用javadoc插件的“de
有什么建议可以解决这个问题吗?我自己已经找到了解决办法。这是一个有点黑客,但它确实为我工作。我选择了我的第一个想法: 获取我想要包含的工件(sources.jar),解压它们,并以某种方式将javadoc插件指向源目录 此解决方案有四个不同部分,我将在后面详细解释:
<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>
Assembly.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>
${project.build.finalName}
拉链
假的
目标/站点/apidocs
/
<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>
<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>
<?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>