Skip to content
Weißes virtual7-Logo auf grünem Hintergrund mit stilisierter Sieben im Hintergrund.

Maven

Manual deployment to an artifactory using maven

admin@alpha-alpaka.de

Copy Link

Link copied

Developers often face the situation that they need to add artifacts manually to a repository manager like the Maven Artifactory. In one of my last projects I also faced this situation. I had to manually add an artifact into a remote repository so that it would be shared with other developers in that project. I solved the task by using the build managing tool maven along with the repository manager maven artifactory.

Artifacts-Configuration

A repository typically contains more than the artifact itself – POMs, the metadata, MD5 and SHA1 hash files are examples of what could be in the repository as well. To deploy built artifacts you need to add a deployment element in the POM file with the URL of a target local repository to which you want to deploy your artifacts.

<distributionManagement>
    <repository>
        <id>snapshot</id>
        <name>ex-snapshot-local</name>
        <url>http://localhost:8081/artifactory/ex-snapshot-local</url>
    </repository>
</distributionManagement>

In our Example I needed to deploy a “Model” Project as “jar” file and a “ViewController“ as “war” file. I defined this in a root-POM (workspace POM)

 <modules>
    <module>Model</module>
    <module>ViewController</module>
 </modules>
 <distributionManagement>
    <repository>
        <id>snapshot</id>
        <name>ext-snapshot-local</name>
        <url>http://localhost:8081/artifactory/ext-snapshot-local</url>
    </repository>
 </distributionManagement>
    <dependencies>
        <dependency>
            <groupId>TestApp</groupId>
            <artifactId>Model</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>TestApp</groupId>
            <artifactId>ViewController</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>

 

Maven deploy Plugin

The deploy plugin is primarily used during the deploy phase. It can also be used to deploy a particular artifact (e.g. a third party jar like Sun’s non redistributable reference implementations).

Deploying means not only copying the artifacts, but making sure all this information is correctly updated. It’s the responsibility of the deploy plugin that the plugin will be added to the Application-POM.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <skip>false</skip>
    </configuration>
</plugin>

 

Deploy

To install the Artifact I use “mvn deploy” and my Test-Project will be installed in the Repository Manager – in my case the maven artifactory.

maven deploy

deploymentArtifactory


Artifactory
Build
deploy
Maven

Warning: file_exists(): open_basedir restriction in effect. File(action-scheduler-en_US.mo) is not within the allowed path(s): (/var/www/vhosts/digitalewege.de/:/tmp/) in /var/www/vhosts/digitalewege.de/v7-stage.digitalewege.de/virtual7de_alphaalpaka_2024/web/app/plugins/wpml-string-translation/classes/MO/Hooks/LoadTranslationFile.php on line 82

Warning: file_exists(): open_basedir restriction in effect. File(action-scheduler-en_US.l10n.php) is not within the allowed path(s): (/var/www/vhosts/digitalewege.de/:/tmp/) in /var/www/vhosts/digitalewege.de/v7-stage.digitalewege.de/virtual7de_alphaalpaka_2024/web/app/plugins/wpml-string-translation/classes/MO/Hooks/LoadTranslationFile.php on line 85

Warning: realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/vhosts/digitalewege.de/:/tmp/) in /var/www/vhosts/digitalewege.de/v7-stage.digitalewege.de/virtual7de_alphaalpaka_2024/web/wp/wp-includes/l10n/class-wp-translation-controller.php on line 106