MavenSnapshotRepository

The JBoss Maven snapshot repository is hosted on http://repository.jboss.org.  A Maven snapshot repository only contains temporary development versions of project artifacts.  These include nightly builds and other temporary test builds.  This does not include alpha, beta, rc, or other tagged versions.  Release versions are located in the JBoss releases repository.

 

Snapshot Cleanup

 

The repository is currently configured to remove snapshots older than 90 days.  The repository will also remove snapshots if the project has been released.

 

Downloading from the Snapshot Repository

 

Artifacts in the JBoss snapshot repository are automatically included in the repository Group URLs.  This means that by following the configuration in either Maven Getting Started - Users or Maven Getting Started - Developers your build will automatically have access to all artifacts in the snapshot repository.

 

If you need to use the snapshot repository by itself, you would need to add the following URL to your Maven settings:

https://repository.jboss.org/nexus/content/repositories/snapshots/

 

 

Deploying a maven project to the repository

 

To use the snapshot repository you will have to configure your maven POM files to point to the repository.  The recommended way to do this is to inherit the required configuration from the jboss parent pom:

 

  <parent>
    <groupId>org.jboss</groupId>
    <artifactId>jboss-parent</artifactId>
    <version>5</version>
  </parent>

 

The parent pom includes the following configuration for uploading your project jars to the snapshot repository.  The URL to the snapshot repository is located in the distributionManagement section of the pom.

  <distributionManagement>
    <snapshotRepository>
      <id>jboss-snapshots-repository</id>
      <name>JBoss Snapshot Repository</name>
      <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

 

 

Only authenticated users can deploy to the JBoss snapshots repository, so you will need to configure Maven to use your JBoss.org username and password to deploy to this repository.  For this, you will have to modify the servers section of maven settings file (~/.m2/settings.xml).  Something similar to the following should be added:

  <servers>
...
    <server>
      <id>jboss-snapshots-repository</id>
      <username>user</username>
      <password>pass</password>
    </server>
  </servers>

 

 

After these configuration steps are complete, run "mvn deploy" , and your project will be built and uploaded to the repository.

 

Deploying individual files to the snapshot repository

 

Sometimes you may have a jar file that you want to deploy to the snapshot repository.  The command for doing this should look something like the following:

 

mvn deploy:deploy-file -DgroupId=org.jboss.myproj -DartifactId=myproject -Dversion=1-SNAPSHOT -Dpackaging=jar \    
                       -DgeneratePom=true -Dfile=path/to/file/myproject.jar \
                       -DrepositoryId=jboss-snapshots-repository \ 
                       -Durl=https://repository.jboss.org/nexus/content/repositories/snapshots/

 

 

Old Information

 

In maven 2.0.9 or higher the webdav protocol is supported by default.  With maven versions prior to 2.0.9, you must load the webdav extension in order to upload using the webdav protocol.  This can be done by placing a basic pom with the webdav extension in the same directory where you are running .  The pom can look something like this:

 

  <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.jboss</groupId>
    <artifactId>webdav-loader</artifactId>
    <version>1</version>
    <name>JBoss Webdav Extension pom</name>
    <build>
      <extensions>
        <extension>
          <groupId>org.apache.maven.wagon</groupId>
          <artifactId>wagon-webdav</artifactId>
        </extension>
      </extensions>
    </build>
  </project>

 

Using artifacts from the snapshot repository

 

If you would like to use files from the snapshots repository, first add the parent configuration shown above.

The parent pom includes configuration for using the snapshot repository.  You could also put this configuration in your settings.xml file located at $MAVEN_HOME/conf/settings.xml

 

    <repository>
      <id>snapshots.jboss.org</id>
      <name>JBoss Snapshot Repository</name>
      <url>http://snapshots.jboss.org/maven2</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>

 

 

Then simply add dependencies to your project and specify the appropriate SNAPSHOT version.

<dependency>
  <groupId>jboss</groupId>
  <artifactId>some-project</artifactId>
  <version>1.2-SNAPSHOT</version>
</dependency>

Maven will automatically download the latest snapshot version from the repository. To depend on an assembly artifact, add the assembly artifact classifier to the dependency. For example, to depend on the some-project-1.2-SNAPSHOT-spi.jar:

 

<dependency>
  <groupId>jboss</groupId>
  <artifactId>some-project</artifactId>
  <version>1.2-SNAPSHOT</version>
  <classifier>spi</classifier>
</dependency>

 

 

Deploying Files Using the Maven Ant Tasks

 

The Maven Ant Tasks can also be used to deploy Artifacts to the snapshot repository.  The first step is to download the Maven ant tasks from the maven download page.  Then an Ant script similar to the following can be used for uploading artifacts.

 

<project name="upload-jars" xmlns:maven="urn:maven-artifact-ant" default="deploy">
  
  <target name="deploy">
    
    <path id="org.apache.maven.ant.tasks.classpath">
       <pathelement path="/home/me/Download/maven-ant-tasks-2.0.10.jar"/>
    </path>
    
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
             classpathref="org.apache.maven.ant.tasks.classpath" />
    
    <artifact:pom id="mypom" file="pom.xml" />
     
    <artifact:install-provider artifactId="wagon-webdav" version="1.0-beta-2"/>
    
    <artifact:deploy file="target/project-a-1.1-SNAPSHOT.jar">
       <pom refid="mypom"/>
       <remoteRepository url="dav:https://snapshots.jboss.org/maven2">
         <authentication username="${username}" password="${password}"/>
       </remoteRepository>
     </artifact:deploy>

  </target>
               
</project>

Removing artifacts from the snapshot repository

 

If you wish to remove artifacts from the snapshots repository, you may mount the WebDAV server as a remote file volume and simply delete files as necessary. For example, on Fedora:

Mounting from Nautilus (Gnome File Manager)

You may mount the WebDAV server using the Nautilus file manager. Click on "Places", then "Connect To Server".  Select "Custom Location".  Enter the URL:

 

davs://snapshots.jboss.org/maven2/

 

You should be prompted for your jboss.org username and password.  A Nautilus window will appear that can be used to browse and edit repository files.

 

Another option is to select "Secure WebDAV" for the service type, and use snapshots.jboss.org for the server name, maven2 for the folder name. Clicking on connect will display a username and password dialog box, where you should supply your jboss.org username and password here. If authentication siucceeds, you will be presented with a view of the file system on the WebDAV server in a Nautilus file manager window. After making changes, in the Nautilus file manager window, select Unmount Volume.

Mounting from Command Line

Alternatively, if you have the package wdfs installed, you may mount the file system from the command line:

 

# wdfs https://snapshots.jboss.org /mnt/webdav -o  allow_other

 

The mount point /mnt/webdav needs to have been created beforehand. The allow_other option is important as without it only root can view the mounted files. You can supply the username and/or password as options if you wish; leaving them out will cause you to be prompted for them. To unmount just do umount  /mnt/webdav as you would with any mounted file system.