apache + WebDAV ã§Maven2ãªãã¸ããªãæ§æããã¡ã¢
æè¿ã¯JenkinsCIãèªç¶ã«ä½¿ãããããã«ãªããJavaã®ãã«ãç°å¢ãMavenã§çµ±ä¸ãã¦ããã¨ä¾¿å©ã§ããã§ãããMavenã¯çµæ§çãå¼·ãã¦ä½¿ãããªãã®ã¯æå¤ã¨å¤§å¤ã§ãdeployå¨ãã¯çµæ§é¢åã§ãã社å ãå人çã«é å¸ãããããã¸ã§ã¯ãããªãã¸ããªã«é å¸ããæé ãã¡ã¢ãã¦ããã¾ããå°ãSakura VPS + CentOS5.5ãããããã¼ã¹ã«ãã¦ã¾ãã
mvn deploy
Mavenã使ã£ã¦ããã¸ã§ã¯ãããªãã¸ããªã«deployï¼é åï¼ããã«ã¯ããmvn deployãã³ãã³ãã使ãã¾ããdeployæã«ã¯ãã³ã³ãã¤ã«ãããã¹ãã¾ã§è¡ãããæå¾ã«ããã¸ã§ã¯ãã®ææç©ããªãã¸ããªã«deployããã¾ããdeployæ¹æ³ã¨ãã¦ã¯ä»¥ä¸ã®æ¹æ³ãã¨ãã¾ããããã¼ã«ã«ãã¡ã¤ã«ã·ã¹ãã ã«deployããäºã¯ãµãã¼ãããã¦ãã¾ããã
åé¡ã¨ãªãã®ã¯ãdeployå¾ã®ãã¼ããã·ã§ã³ã§ããããªãã¸ããªã¨ãã¦å ¬éãããªãã°å ¬éã§ããå ´æã»ãã¼ããã·ã§ã³ã«ç½®ãå¿ è¦ãããã¨è¨ããã¨ã§ããapacheã§å ¬éãããªãã°ãCentOSã®å ´åãapacheã¦ã¼ã¶ã§è»¢éãããæã§ããããããftpãsshã§è»¢éããã¨ãã«apacheã¦ã¼ã¶ã¨ãã¦è»¢éããã®ã¯å°ã æéãªã®ã§ãwebdavã使ãã®ã楽ã§ãã
apacheã®è¨å®
apacheã¯mavenã®ãªãã¸ããªã®è¨å®ãè¡ããwebdavãæå¹ã«ãã¾ããæè¿ã®apacheã§ã¯ããã©ã«ãã§çµã¿è¾¼ã¾ãã¦ããã®ã§ãconfãå¤æ´ããã ãã§è¯ãããã§ãã
VirtualHostã使ã£ã¦ããå ´åã¯ããããªæãã«ãªãã¾ãã
# http://maven.deathmarch.jp/
ServerName maven.deathmarch.jp
Alias /maven2 /var/maven2/repository
Options Indexes FollowSymLinks
DAV On
AuthType Digest
AuthName WebDAV
AuthUserFile /xxxx/xxx/.htdigest
require valid-user
/var/maven2/repository ããªãã¸ããªã¨ãã¦ãã¾ã*1ãã¾ãããã®ã¾ã¾webdavã¨ãã¦ã¢ã¯ã»ã¹ã§ããããã«ããDAV Onããæå®ãã¾ããã¾ãã誰ã§ãæ¸ãè¾¼ããã®ã¯ä¸å³ãã®ã§ãDigestèªè¨¼ã§å¶éãããã¦ããã¾ããwebdavã¯httpçµç±ã§ã¢ã¯ã»ã¹ããã¤ã³ã¿ã¼ãã§ã¤ã¹ã§ãã®ã§ãGETçãé¤ãã¦èªè¨¼ãå¿
è¦ã¨ãã¦ããã°è¯ãã§ãããã
ãªãã¸ããªã®è¨å®ã¯ããã ãã§å®äºã§ãã
pom.xmlã®è¨å®
pom.xml ã«ã¯2ã«æè¨å®ããå¿
è¦ãããã¾ãã
1ã¤ç®ã¯ããã¸ã§ã¯ãã®deployå
ã®è¨å®ã§ããdistributionManagementã¿ã°ã«ãªãã¸ããªãæå®ãã¾ããããã§ãidã¨urlãæå®ãã¦ããã¾ãã
<distributionManagement> <repository> <id>maven.deathmarch.jp</id> <name>deathmarch.jp Repository</name> <url>dav:http://maven.deathmarch.jp/maven2</url> </repository> </distributionManagement>
ããï¼ã¤ã¯ãdeployã®æã«ä½¿ç¨ããwagonã¢ã¸ã¥ã¼ã«ã®è¨å®ã§ãã
<build> ... <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav-jackrabbit</artifactId> </extension> </extensions> </build>
buildã¿ã°ã®æå¾ã«extensionsã¿ã°ã追å ãã¦ãã ãããããã§ã¯ã¾ãããããã¤ã³ãã§ãããextensions/extension ã¨ãªã£ã¦ããããwagon-webdav-jackrabbitãwagon-webdavã«ãªã£ã¦ããªããã確èªãã¦ãã ãããå¤ãæ å ±ã§ééã£ãç´¹ä»ã¨ãªã£ã¦ãããµã¤ããããã¾ãã
settings.xmlã®è¨å®
webdavã«ã¢ã¯ã»ã¹ããã¦ã¼ã¶ã¨ãã¹ã¯ã¼ãã¯ããããã¤ãè¡ããã·ã³ã®.m2/settings.xmlã§æå®ãã¾ããããã§ãªãã¸ããªã®IDã対å¿ããã¦ãã ããã
<settings> <servers> <server> <id>maven.deathmarch.jp</id> <username>USER_NAME</username> <password>PASSWORD</password> </server> </settings>