Showing posts with label artifactory. Show all posts
Showing posts with label artifactory. Show all posts

Tuesday, 12 September 2017

How to deploing jars to your artifactory server

The build phase generates one or more artifacts, maven provides a local repository where to store these artifacts but It is possible to store the artifacts in a remote repository as an Artifactory server.
For deploying jars to your artifactory server you can add the following configuration in your settings.xml (in $HOME/.m2). This configuration stores the credentials for the authentication into artifactory repositories.
<servers>     .......     <server>       <id>central</id>       <username>user</username>       <password>password</password>     </server>     <server>       <id>snapshots</id>       <username>user</username>       <password>password</password>     </server>     ....... <servers>
Now yoiu can add the repository configuration always in settings.xml.
<repositories> ......   <repository>     <snapshots>         <enabled>false</enabled>     </snapshots>     <id>central</id>     <name>libs-releases</name>     <url>http://myartifactory:8080/artifactory/libs-releases</url>   </repository>   <repository>     <snapshots>         <enabled>true</enabled>         <updatePolicy>always</updatePolicy>         <checksumPolicy>fail</checksumPolicy>     </snapshots>     <id>snapshots</id>     <name>libs-snapshots</name>     <url>http://myartifactory:8080/artifactory/libs-snapshots</url>   </repository> ...... <repositories>
You can execute the following command:
$ mvn deploy
If your maven project version has a SNAPSHOT version then the jars will be deployed on "libs-snapshots" repo, else they will be deployed in "libs-releases".
If you want deploy the jars in a repo not configured in settings.xml file, you can use -DaltDeploymentRepository option. Example:
$ mvn deploy -DaltDeploymentRepository="otherRepoReleases::default::https://otherartifactory:8180/artifactory/otherRepoReleases"
Surely the repository requires authentication that you can configure in settings.xml as shown above.

Welcome

Hello everybody, Welcome in my blog called "Information technology archive". Obviously the topics will be related to Informatio...