Thursday, 23 August 2018

How to deploy an external artifact to repository in pom.xml


We can use "maven-deploy-plugin" to upload any artifact to repository from a location by pom.xml.
By this we can upload any artifact without uploading the generated artifacts, also without install/deploy goal.

....
</plugins>
....
<plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.2</version>
    <executions>
        <execution>
            <id>deploy-file</id>
            <phase>clean</phase> <!-- The phase in which you want to upload the file to Repository . In this case "mvn clean " goal will upload the artifact.-->
            <goals>
                <goal>deploy-file</goal>
            </goals>
            <configuration>
<repositoryId>maven-public</repositoryId>  <!-- This is the id which contains the user/pass to connet to Nexus. This will be under "servers" section in settings.xml -->
                <file>C:\Users\bismayam\Desktop\poc.jar</file>
                <url>http://<host>:<port>/nexus/content/repositories/test-releases/</url>
                <groupId>testGroup</groupId>
                <artifactId>testArtifact</artifactId>
                <version>1.0</version>
                <packaging>jar</packaging>
            </configuration>
        </execution>
    </executions>
</plugin>
</plugins>

No comments:

Post a Comment

Thank You for your valuable comment

Difference between class level and object locking and static object lock

1) Class level locking will lock entire class, so no other thread can access any of other synchronized blocks. 2) Object locking will lo...