Apache Archiva

Apache Arhiva

Repositorios Maven Locales

Cuando tenemos problemas de conexion podemos usar un repositorio local para maven

Instalacion

URL:

http://www.mkyong.com/maven/how-to-install-apache-archiva-in-ubuntu/

Descargarlo desde

http://archiva.apache.org/index.cgi

Se pueden descargar dos versiones, usaremos el Standalone

Descomprimir el archivo

tar -xvzf apache-archiva-1.2.2-bin.tar.gz

Iniciarlo

~/Desktop/apache-archiva-1.2.2/bin$ ./archiva

Usage: ./archiva { console | start | stop | restart | status | dump }

/Desktop/apache-archiva-1.2.2/bin$ ./archiva start
Starting Apache Archiva...

Terminado

Done

Access Apache Archiva web admin viahttp://localhost:8080/archiva.

Post Installation

You may need to change the Apache Archiva default 8080 port number to avoid port conflict issue.

1. Archiva configuration file

Access the Apache Archiva web container configuration file “{achiva_folder}/conf/jetty.xml“, edit it with your favor editor.

vim {achiva_folder}/conf/jetty.xml

2. Update port number

Find the following pattern

<Call name="addConnector">
   <Arg>
       <New class="org.mortbay.jetty.nio.SelectChannelConnector">
         <Set name="host"><SystemProperty name="jetty.host"/></Set>
         <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
         <Set name="maxIdleTime">30000</Set>
         <Set name="Acceptors">2</Set>
         <Set name="statsOn">false</Set>
         <Set name="confidentialPort">8443</Set>
     <Set name="lowResourcesConnections">5000</Set>
     <Set name="lowResourcesMaxIdleTime">5000</Set>
       </New>
   </Arg>
</Call>

Change the jetty port to other post – 8888

<Set name="port"><SystemProperty name="jetty.port" default="8888"/></Set>

3. Restart it

Restart Apache Archiva to take effect, done.

mkyong@mkyong-desktop:~/Desktop/apache-archiva-1.2.2/bin$ ./archiva restart
Stopping Apache Archiva...
Stopped Apache Archiva.
Starting Apache Archiva...

Now, you can access the Apache Archiva web admin via

http://localhost:8888/archiva

.Configurar Maven Central

How to integrate between Apache Archiva and Maven

https://www.mkyong.com/maven/how-to-integrate-between-apache-archiva-and-maven/

3. Add mirror setting

Locale the Maven’s configuration file, “{mavendir}/conf/settings.xml “, update the mirror setting to your Apache Archiva repository.

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
        <id>internal</id>
        <name>Proxy Cache - Internal Repository</name>
        <url>http://localhost:8080/archiva/repository/internal</url>
        <mirrorOf>*</mirrorOf>
    </mirror>

  </mirrors>

* url tag – It is your Archiva remote repository sever address. * mirrorOf tag – mirror everything

P.S More detail aboutMaven mirror settings

4. Done

The different!?

Here’s the different before and after the Apache Archiva integration.

Before integrate Archive

All the dependency libraries are download from Maven central repository.

E:\project\projectname>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building projectname Maven Webapp
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Copying 0 resource
Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.14/log4j-1.2.14.pom
Downloading: http://repo1.maven.org/maven2/log4j/log4j/1.2.14/log4j-1.2.14.jar
[INFO] [compiler:compile {execution: default-compile}]

After integrated Archive

All the dependency libraries are download from your own remote repository (Archiva) server.

E:\project\projectname>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building projectname Maven Webapp
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Copying 0 resource
Downloading: http://localhost:8888/archiva/repository/internal/log4j/log4j/1.2.14/log4j-1.2.14.pom
2K downloaded  (log4j-1.2.14.pom)
Downloading: http://localhost:8888/archiva/repository/internal/log4j/log4j/1.2.14/log4j-1.2.14.jar
358K downloaded  (log4j-1.2.14.jar)
[INFO] [compiler:compile {execution: default-compile}]

Last updated

Was this helpful?