2

I want to create the Javadoc files of my project on the SVN-server right after I commited it, meaning that I want the server to do the work.

I already looked in the maven-javadoc-plugin examples section, but I could not find a suitable solution. (Maybe I just didn't understand it, I am new to Maven. If so, please be lenient and explain it to me)

It is important to notice, that I do not want Maven to generate the Javadoc on every build as it would be a big perfomance loss. I could just figure out, that <reporting/> should be the correct location.

I am using eclipse IDE for Java EE developers and Maven 3.

Thank you in advance

Dominik Reinert
  • 1,075
  • 3
  • 12
  • 26

1 Answers1

0

A possible solution would be to create a post-commit hook that invokes the javadoc utility directly on the command line.

A post-commit hook is a script that is executed by the SVN server right after a successful commit. To create a post-commit hook, please refer to this question (or this blog). Basically, it comes down to modifying the post-commit.tmpl template script that is located in the hooks directory of your SVN server.

The script will need to execute the javadoc utility. It will depend on your current OS and SVN repository directory structure, but assuming Linux and a project called myProject with parent package com, it could be:

#!/bin/sh

REPOS="$1"
REV="$2"

/path/to/jdk/bin/javadoc -d ${REPOS}/myProject/target/javadoc -sourcepath "${REPOS}/myProject/src/main/java" -subpackages com

In this script, REPOS refers to the location of the SVN repository. This hook will invoke javadoc and tells it to store the generated Javadoc inside the target folder of myProject of all the classes inside src/main/java with common subpackage com.

Community
  • 1
  • 1
Tunaki
  • 132,869
  • 46
  • 340
  • 423
  • Thanks for your answer! Just one question left: What is the #!/bin/sh for windows? – Dominik Reinert Nov 13 '15 at 09:47
  • @DoRe Actually, there no such thing for Windows. You will need to create a batch script. SVN invokes it with 2 parameters (`$1` and `$2` above, but it is a different syntax for batch scripts). – Tunaki Nov 13 '15 at 09:52
  • Yeh, I found this _SET REPOS..._ thing. Man I hate windows. Thanks anyway :) – Dominik Reinert Nov 13 '15 at 10:17