Intro
Goals
Usage
Javadoc 을 remote 에 upload 하기
scp 를 이용하여 remote 에 upload 할 수 있다. Upload 된 javadoc 는 Web 를 통해 review 할 수 있으며 Confluence 의 html-include macro 를 사용하여 Page 에서 바로 참고 가능하다.
이 기능을 사용하려면 Project report 에서 javadoc 을 생성하게 pom 파일을 변경해야 한다.
settings.xml 설정
<servers> <server> <id>javadocServer</id> <username>javadoc</username> <password>javadocPwd</password> <configuration> </configuration> </server> </servers>
pom.xml 설정
distributionManagement의 URL 에 ssh 를 사용하려면 wagon-ssh 가 필요하다.
<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9.1</version> <configuration> </configuration> </plugin> </plugins> </reporting> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>3.3</version> <dependencies> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh</artifactId> <version>2.6</version> </dependency> </dependencies> </plugin> </plugins> </build> <distributionManagement> <site> <id>javadocServer</id> <url>scp://myserver/var/www/html/javadoc/${project.artifactId}</url> </site> </distributionManagement>
적용
mvn site-deploy
TroubleShooting
site-deploy 실패
다음과 같은 메시지가 발생하고 site-deploy 가 실패하는 경우가 있다.
Unable to configure Wagon: 'scp': While configuring wagon for 'java-doc': Unable to apply wagon configuration. Cannot find setter, adder nor field in org.apache.maven.wagon.providers.ssh.jsch.ScpWagon for 'sshExecutable' -> [Help 1]
원인은 오래된 site plugin 문서에서는 scpExecutable, sshExecutable 등으로 실행할 ssh, scp 프로그램을 지정하라고 되어 있으나 wagon-ssh 는 Pure Java로 구현된 jsch라는 ssh client를 내장하고 있다. Pure Java 이므로 외부 프로그램이 필요없으므로 아래와 같은 setter 가 없어서 발생하는것이니 scpExecutable, sshExecutable 항목이 있으면 삭제하면 된다.
maven site 가 느릴때
mvn site 시에 다음과 같은 메시지가 출력되고 시간이 오래 걸림
Generating "Dependencies" report --- maven-project-info-reports-plugin:2.7
프로젝트에 사용된 library 의 의존성 확인을 위해 remote repository 에 연결하여 시간이 오래 걸림.
처리방법
-o 옵션으로 offline 모드로 구동
mvn -o site-deploy
reporting 항목의 maven-project-info-reports-plugin 에서 dependencyLocationsEnabled 를 false 로 설정
pom.xml<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.7</version> <configuration> <dependencyLocationsEnabled>false</dependencyLocationsEnabled> </configuration> </plugin> </plugins> </reporting>
참고 자료