I want to store builds in my own directory and I don't want to run Sonatype Nexus or similar. Is this possible?
I set up Jenkins to deploy artifact into my Maven repository and filled in this URL
file:///home/tomas/.m2/repository
If I try to build the project, I will get this exception
Maven RedeployPublished use remote  maven settings from : /var/lib/jenkins/tools/mvn/conf/settings.xml
[INFO] Deployment in /home/tomas/.m2/repository (id=,uniqueVersion=true)
Deploying the main artifact wst-root-pom-1.0.pom
ERROR: Failed to deploy artifacts/metadata: No connector available to access repository  (/home/tomas/.m2/repository) of type default using the available factories WagonRepositoryConnectorFactory
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts/metadata: No connector available to access repository  (/home/tomas/.m2/repository) of type default using the available factories WagonRepositoryConnectorFactory
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:141)
    at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:182)
    at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:176)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:998)
    at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:625)
    at hudson.model.Run.run(Run.java:1435)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:481)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:238)
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts/metadata: No connector available to access repository  (/home/tomas/.m2/repository) of type default using the available factories WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:235)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:211)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:443)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
    ... 11 more
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector available to access repository  (/home/tomas/.m2/repository) of type default using the available factories WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector(DefaultRemoteRepositoryManager.java:400)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:231)
    ... 14 more
[INFO] Deployment failed after 0,26 sec
Build step 'Deploy artifacts to Maven repository' changed build result to FAILURE
Finished: FAILURE
                I recall that is a maven 3 compatibility problem. According to the notes: https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-TransportProtocols%2528Wagons%2529
Unlike Maven 2, Maven 3 supports out of the box only http:, https: and file: as transport protocols. To use other transport protocols like scp:, the appropriate wagons have to be explicitly declared in the POM as a build extension. If the wagon in question is only used for deployment to a repository, it can alternatively be declared as a dependency of the Maven Deploy Plugin.
So make sure you are using Maven 3, otherwise you have to download your own wagon as an maven extension. Here is a guide to using Maven extensions: http://maven.apache.org/guides/mini/guide-using-extensions.html
Note: Wagon 1.0-beta-3+ requires Maven 2.1.0 or above. For Maven 2.0.10 and earlier, use Wagon 1.0-beta-2.
<project>
  ...
  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-file</artifactId>
         <version>1.0-beta-3</version>
      </extension>
    </extensions>
  </build>
  ...
</project>
That should resolve your issue. If it doesn't work, double check your maven path to see if different versions don't conflict.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With