Wednesday, 27 April 2016

Upload and Download artifacts from Nexus by cmd line

Download command
-------------------------
mvn -C org.apache.maven.plugins:maven-dependency-plugin:2.4:get
-DremoteRepositories={URL of the repository}
-DgroupId={groupID} -DartifactId={artifactId} -Dversion={version} -Dpackaging=jar -DupdateReleaseInfo=true


Upload command
----------------------
mvn deploy:deploy-file -Dfile=file_FullPath
-DgroupId=*** -DartifactId=*** -Dversion=***
-Dpackaging=jar   -Durl={repo_url} -DrepositoryId={id from setting.xml}

It will download the respective maven plugins to the M2_REPO and then it will upload the artifacts specified. There should be maven installed in the machine where you are trying to upload/download.


Setting.xml
--------------

 <localRepository>C:\M2_REPO</localRepository>

<servers>
  <server>
      <id>releases</id>
      <username>deployment</username>
      <password>deployment123</password>
    </server>
  <server>
        <id>snapshots</id>
        <username>deployment</username>
        <password>deployment123</password>
  </server>



<mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>external:*</mirrorOf>
      <url>http://indlin714:28081/nexus</url>
    </mirror>


<profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <activation>
              <activeByDefault>true</activeByDefault>
         </activation>    
<repositories>
        <repository>
          <id>releases</id>
          <url>http://host:port/nexus/content/repositories/testRepository</url>
          <releases><enabled>true</enabled></releases>
        </repository>
     
  <repository>
         <id>snapshots</id>
          <url>http://host:port/nexus/content/repositories/isr-fnd-public</url>
          <snapshots><enabled>true</enabled></snapshots>
         </repository>

</repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>


<activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>











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...