initSourceTargetRepo( );
// START SNIPPET: copy-artifact
// configure the artifact you want to copy
// if package ommited default will be jar
ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest( );
artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
artifactTransferRequest.setVersion( "2.2.2" );
artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
// retrieve the service
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
// copy the artifact
Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
// END SNIPPET: copy-artifact