Generate javadoc in maven and then upload via scp?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 06:28:22

问题


I have Maven javadoc plugin working nicely right now, but I do not know how to add it to the remote directory via scp.

How do I transfer the javadoc files via scp, but AFTER they have been generated? Can this automatically happen when I call site:site?

Thanks!


回答1:


maven-javadoc-plugin doesn't attach to any phase/goal by default, you need configure it manually in pom.xml.

See Generate Javadocs As Part Of Project Reports:

To generate javadocs as part of the site generation, you should add the Javadoc Plugin in the section of your pom:

 <project>
    ...
    <reporting>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.8.1</version>
          <configuration>
            ...
          </configuration>
        </plugin>
      </plugins>
      ...
    </reporting>
    ...
  </project>

When you execute mvn site, the javadocs will be generated and included in the generated site. A link to the javadocs will be added in the Project Reports menu.


Alternatively, if you use maven-release-plugin, javadoc generation (and upload) is automatically handled by default, see here:

The following delvierables are created and deployed to local and remoted repositories after the execution of the release:perform goal has finished.

  • artifact id-version.jar
    The binaries for the current release of the project.

  • artifact id-version-javadoc.jar
    The javadoc explaining the current functionality of the classes within the current release.

  • artifact id-version-source.jar
    The source code revisions used to build the current release of the project.

  • artifact id-version.pom
    The contents of the pom.xml file used to create the current release of the project.


If you want to attach javadoc generation to some phase/goal other than site, check out How to deploy Javadoc jar file?



来源:https://stackoverflow.com/questions/11336496/generate-javadoc-in-maven-and-then-upload-via-scp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!