0

I am setting up a CI system with repository archive, based on apache Archiva. Among various techniques for deploying file there, the most promising one seems to be using maven (as opposed to REST api that would require too much curl calls and Web interface that is not for automation).

It seems that for deploying artifact, such as zip archives of build artifacts, in maven there is a following plugin: deploy:deploy-file. However an attempt to simply invoke that command gave me no results.

I did not work with maven before; currently our builds are done by invoking cmake on source directory, then make from shell script. What do i need to add and have to be able to use maven for deploying the resulting artefact?

Is it necessary to create a pom file? If so, what steps do i need to add?

Srv19
  • 3,458
  • 6
  • 44
  • 75

3 Answers3

1

You can use deploy:deploy-file to upload these artifacts, and by default it will generate a POM for you. What you will need is to:

  1. install Maven
  2. create a settings.xml file, with a <server> element that contains the credentials for deploying to Archiva over HTTP

There's a bit more information here: http://maven.apache.org/plugins/maven-deploy-plugin/usage.html. If you are generating the POM, then you will need to supply the groupId (distinct grouping of artifacts), artifactId (filename without version), version (artifact version), and packaging (typically extension, such as zip) parameters along with the required ones of repositoryId, url and file.

However, it's not required to use Maven, or the REST API - you can also just use a simple HTTP PUT call:

curl -T artifact.zip http://localhost:8080/archiva/repository/my-releases/group/artifact/version/artifact-version.zip

You may also use scp, ftp, etc. to place the file directly in the Archiva filesystem. Note that in that case, you'll have to wait for Archiva's scheduled scan to pick it up.

Brett Porter
  • 5,827
  • 27
  • 25
0

Maven needs a WebDAV like repository (see also Nexus, Artifactory) to deploy its artifacts (mostly jar, war, ear or assemblies. Look here for a how to on setting up Maven with Archiva.

mp911de
  • 17,546
  • 2
  • 55
  • 95
0

Yes, it is necessary to have pom.xml in maven and also it is obvious that you need maven to be installed on your machine. Bare minimum, you need to provide artifact ID(like name of jar), group id(like package to identify the location of artifact in repository) and version. By default package structure will be jar unless you mention it as war/ear/pom. If you want to use any dependencies you can mention them in dependencies section.

Following is the minimum pom that is required.

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Quick Start Archetype</name>
</project>

Here is the quick tutorial to get acquainted with maven.

Bala
  • 1,295
  • 1
  • 12
  • 23
  • From what i have read, artifact id, version etcetera could be passed to maven as command line parameters. What i would like to is to learn how to deploy arbitrary artifacts (mostly zip archives) - since projects are already made with cmake, i would prefer to avoid duplicating their descriptions into xml maven consumes. – Srv19 Sep 16 '14 at 06:13
  • You can pass these values using command prompt. And execute the goals from command prompt(Through your cmake file). But end of the day maven creates pom.xml and use that file when you execute goals from command prompt. I don't think there is a way to skip pom in maven. – Bala Sep 16 '14 at 06:58