Archiva provides a rudimentary user management through the web
interface.  I.e., you need to create a user and assign the user roles
that allow read access (Repository Observer) or write access (Repository
Manager).  So, you will need the <server>s.

   You didn't mention deployment originally.  If you want to deploy to
Archiva, you'll need to define repositories in your settings.xml. Here's
what I have;

   In Archiva;

        3 Managed repositories; "internal", "dev" and "cm".
        2 users; "m2repo" is Global Observer, and "dev" Manager,
                "cmadmin" is Global Observer, and "cm" Manager,
        6 Remote Repositories that are proxy connected to "internal"

   In settings.xml; Note that some sections get commented in/out
depending on whether you are a developer or cmadmin.

<settings>

    <!-- server for repo deployment. -->

    <servers>
      <server>
        <id>internal</id>
        <username>m2repo</username>
        <password>m2repo-public-password</password>
      </server>
      <!-- CM users have a secret password to have read/write access in the CM 
repo -->
      <!--server>
        <id>cm</id>
        <username>cmadmin</username>
        <password>cmadmin-secret-password</password>
      </server-->
      <!-- developers use a group password to have read-only access in the CM 
repo -->
      <server>
        <id>cm</id>
        <username>m2repo</username>
        <password>m2repo-public-password</password>
      </server>
      <server>
        <id>dev</id>
        <username>m2repo</username>
        <password>m2repo-public-password</password>
      </server>
    </servers>
    
    <!-- To use the repo, we need to add it to an active profile -->

    <profiles>
      <profile>

        <id>myProfile</id>

        <activation>
          <activeByDefault>true</activeByDefault>
        </activation>

        <repositories>

          <repository>
            <id>cm</id>
            <name>CM Maven2 Repo</name>
            <url>http://m2repo/archiva/repository/cm</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>false</enabled>
            </snapshots>
          </repository>

          <repository>
            <id>dev</id>
            <name>Development Maven2 Repo</name>
            <url>http://m2repo/archiva/repository/dev</url>
            <releases>
              <enabled>true</enabled>
            </releases>
            <snapshots>
              <enabled>true</enabled>
            </snapshots>
          </repository>

        </repositories>

        <!-- CM users deploy build artifacts to the CM repo -->
        <!--properties>
          <deploy.id>cm</deploy.id>
          <deploy.url>http://m2repo/archiva/repository/cm</deploy.url>
        </properties-->   

        <!-- Developers deploy build artifacts to the development repo -->
        <properties>
          <deploy.id>dev</deploy.id>
          <deploy.url>http://m2repo/archiva/repository/dev</deploy.url>
        </properties>   

      </profile>
    </profiles>

    <mirrors>

      <mirror>
        <mirrorOf>*</mirrorOf>
        <name>Archiva Mirror Repository</name>
        <url>http://m2repo/archiva/repository/internal</url>
        <id>internal</id>
      </mirror>

    </mirrors>

  </settings>

In individual POMs, I use this construct so, developers and cm publish to their 
respective repos, without twiddling with the POMS;

   <!--
       Use properties from ~/.m2/settings.xml to make sure we publish to the 
correct repo
   -->
   <distributionManagement>
      <repository>
          <id>${deploy.id}</id>
          <name>Archiva M2 Repository</name>
          <url>dav:${deploy.url}</url>
      </repository>
   </distributionManagement>

--CB

Reply via email to