- Download nexus-webapp-XXX.war
- Nexus的下載頁面在 http://nexus.sonatype.org/downloads/ ,雖然Nexus也有自帶jetty的版本,但我還是打算使用webapp來安裝,所以下載的是nexus-webapp-XXX.war。
- Deploy nexus-webapp-XXX.war
- 將war改名為nexus.war後直接丟到${tomcat}/webapp下就好。
- 設定sonatype-work權限 (各OS與distribution㑹有所不同)
- 由於nexus需要實體目錄存放下載的檔案,所以㑹在/usr/share/tomcat6下建一個sonatype-work的目錄,但由於/usr/share/tomcat6的權限原屬於root,所以執行
$> sudo mkdir /usr/share/tomcat6/sonatype-work $> sudo chown tomcat6:tomcat6 /usr/share/tomcat6/sonatype-work
後再重起tomcat即可
- 由於nexus需要實體目錄存放下載的檔案,所以㑹在/usr/share/tomcat6下建一個sonatype-work的目錄,但由於/usr/share/tomcat6的權限原屬於root,所以執行
- 再來是設定client端maven2用的setting.xml
- 加入下面的xml到setting.xml,將其中tomcat_ip與tomcat_port改成你實際使用的
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://${tomcat_ip}:${tomcat_port}/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
這樣就有一個Maven Repository Server 可用了! PS:Mac上的maven在mirror中如果用hostname對應ip似乎不正常,在/etc/hosts已經設好了,但是就是連不到,用curl與wget都沒問題…
沒有留言:
張貼留言