Archiva WAR搭建自己的私服

 

1. 部署环境

linux

jdk

maven

tomcat7


2. 安装部署

2.1 下载地址

http://archiva.apache.org/#a

Archiva 1.3.5 WAR

http://labs.mop.com/apache-mirror/archiva/binaries/apache-archiva-1.3.5.war

apache-archiva-1.3.5.war

2.2 安装

2.2.1 部署

cp apache-archiva-1.3.5.war tomcat7/webapps/archiva.war

2.2.2 修改日志文件log4j.xml,添加下面配置:

 <appender name="console" class="org.apache.log4j.ConsoleAppender">

   <layout class="org.apache.log4j.PatternLayout">

     <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>

   </layout>

 </appender>

 <logger name="org.springframework.web">

   <level value="debug"/>

   <appender-ref ref="console"/>

 </logger>

2.2.3 修改WEB-INF/classes/application.properties

# for Windows:

appserver.base=%CATALINA_HOME%

appserver.base=%CATALINA_BASE%

# or, for UNIX:

appserver.base=$CATALINA_HOME

appserver.home=$CATALINA_BASE

2.2.4 修改~/.m2/archiva.xml

<?xml version="1.0" encoding="UTF-8"?>

<Context path="/archiva"

         docBase="${catalina.home}/archiva/apache-archiva-1.1.war">

<Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"

          username="sa"

          password=""

          driverClassName="org.apache.derby.jdbc.EmbeddedDriver"

          url="jdbc:derby:/path/to/database/users;create=true" />

<Resource name="jdbc/archiva" auth="Container" type="javax.sql.DataSource"

          username="sa"

          password=""

          driverClassName="org.apache.derby.jdbc.EmbeddedDriver"

          url="jdbc:derby:/path/to/database/archiva;create=true" />

<Resource name="mail/Session" auth="Container"

           type="javax.mail.Session"

           mail.smtp.host="localhost"/>

</Context>

 

2.2.5 修改applicationContext.xml

<bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">

   <!--

<property name="session" ref="mailSession"/>

-->

<property name="host" value="smtp. gmail .com"/>

   <property name="port" value="25"/>

   <property name="username" value="[email protected]"/>

   <property name="password" value="******"/>

   <property name="javaMailProperties">

       <props>

           <!-- Use SMTP-AUTH to authenticate to SMTP server -->

           <prop key="mail.smtp.auth">true</prop>

           <!-- Use TLS to encrypt communication with SMTP server -->

           <prop key="mail.smtp.starttls.enable">true</prop>

       </props>

   </property>

 </bean>  

   

2.2.6 修改Maven配置文件/root/.m2/setting.xml 如果不存在就新建

<settings>

 <mirrors>

   <mirror>

<id>internal</id>

<name>Proxy Cache - Internal Repository</name>

<url>http://localhost:8080/archiva/repository/internal</url>

<mirrorOf>*</mirrorOf>

    </mirror>

 </mirrors>

</settings>

   

2.2.7 tomcat 启动/停止/重启


3. Archiva应用配置

3.1 配置用户

自己填就可以了

3.2 配置Repositories

系统默认配置2个

基本上没法用

添加一个PUBLIC:

Add URL:http://repository.sonatype.org/content/groups/public/

信息:

Identifier repository.sonatype.org

Name sonatype

URL http://repository.sonatype.org/content/groups/public/

Type Maven 2.x Repository

3.3 配置Proxy Connectors

系统默认配置2个

添加一个:

repository.sonatype.org

sonatype

http://repository.sonatype.org/content/groups/public/

3.4 修改Repositories

编辑Archiva Managed Internal Repository

修改Directory指定到%CATANINA_HOME%/data/repositories/internal

编辑Archiva Managed Snapshot Repository

修改Directory指定到%CATANINA_HOME%/data/repositories/internal

4. 配置检查

cd /root/./m2

maven快速构建

mvn -X archetype:generate

Maven中的依赖关系查看

mvn -X dependency:resolve


5. maven 仓库地址

共有的仓库 

http://repo1.maven.org/maven2/ 

http://repository.jboss.com/maven2/ 

http://repository.sonatype.org/content/groups/public/ 

http://mirrors.ibiblio.org/pub/mirrors/maven2/org/acegisecurity/ 

私有的仓库 

http://repository.codehaus.org/ 

http://snapshots.repository.codehaus.org/ 

http://people.apache.org/repo/m2-snapshot-repository 

http://people.apache.org/repo/m2-incubating-repository/ 

好用:

http://repository.sonatype.org/content/groups/public/


参考地址:

官方guide

http://archiva.apache.org/docs/1.3.5/adminguide/webapp.html

maven常见问题

http://tianya23.blog.51cto.com/1081650/289363

maven plugins

http://maven.apache.org/plugins/index.html

maven 查找依赖jar的dependency标签 地址

http://mvnrepository.com/

安装学习

http://jansel.iteye.com/blog/338783

你可能感兴趣的:(arc)