Search code examples
javamaven-3maven-embedder

how to mvn deploy-deploy:file from java app


I am trying to deploy a file to the local repository using maven-embedder 3.0.4 from java program, but I'm getting following error:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file
(default-cli) on project test: Failed to deploy artifacts/metadata: No connector available   
to access repository local (file://~/.m2/repository) of type default 
using the available factories

I'm trying to achieve this with MavenCli.doMain(String[], String, PrintStream, PrintStream) function, but it seems I can't make it work.

Any help will be very appreciated. Also, if there is another way to deploy file from java program please let me know.


Solution

  • I would suggest to use Aether instead of Maven embedder. Source on github.