Questions tagged [maven-embedder]

Maven is a project development management and comprehension tool.

Maven is a project development management and comprehension tool.

Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file.

Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.

Source:http://maven.apache.org/ref/3.0.2/maven-embedder/index.html

24 questions
44
votes
3 answers

How to run Maven from Java?

I want to execute Maven command from Java for development of a plugin. I tried maven-embedder but looks like it is now not supported. Is someone aware of some other tool which can be used?
ajjain
  • 1,151
  • 2
  • 15
  • 28
8
votes
1 answer

Unable to run maven tasks through MavenCli (maven-embedder)

I am using Maven embedder 3.3.3 in my program to run maven goals programmatically and I get the following error every time I run the MavenCli.doMain method: -Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment…
tr_quest
  • 735
  • 2
  • 10
  • 24
3
votes
3 answers

Invocation of MavenCli fails within a Maven plugin

I've created small util to wrap MavenCli, which generates a new Maven project, using the quickstart archetype. When executing the Util as a unit test, it is working quite well (just generating an empty Maven project). Now I want to integrate this…
Martin Ackermann
  • 884
  • 6
  • 15
3
votes
1 answer

Maven embedded deploy not working with org.apache.httpcomponents.httpclient version 4.4

Within my application I have to (mvn) deploy artifacts programmatically. I do this with the help of the maven-embedder artifact and some really simple code: MavenCli client = new MavenCli(); int result = client.doMain(new String[] { "deploy" },…
2
votes
1 answer

How to resolve maven dependencies inside the maven plugin?

Im trying to use ArtifactResolver.resolve(ArtifactResolutionRequest) with flag resolveTransitively=true and it takes 10min for separated module of my project. ArtifactResolutionRequest request = new ArtifactResolutionRequest() .setArtifact(…
Andrew
  • 470
  • 3
  • 10
2
votes
0 answers

Multiple build with MavenCli.doMain (maven-embedder) failures

I have program which in a loop: Do checkout Build project with MavenCli Analyze with Findbugs But, MavenCli.doMain works only once and return 1 second time. Pom file: org.apache.maven
user2373747
2
votes
2 answers

How to call a maven mojo from java/scala using the maven-embedder

I want to call the help:effective-pom mojo directly from java/scala. Is there a minimal example how to setup the maven-runtime and call the mojo? I assume some context is needed before calling the stuff as supposed in the answer to this…
Bastl
  • 2,926
  • 5
  • 27
  • 48
1
vote
0 answers

How get the logs when I run Maven Projects from Java, With Maven-Embedder?

I want to create a small Monitoring tool for several maven projects. I have three server applications, which should run while in development. We currently have a small shell script that runs them, but is spectacularly inexact when viewing the logs…
Luxusproblem
  • 1,913
  • 11
  • 23
1
vote
2 answers

Maven Embedded 3.3.9 - Is it possible?

So I am trying to embed maven in my code rather than use a shell wrapper however I am having issues getting it to actually work. Source Code The master branch works however it is an older version of maven (3.1.1) and I would like to use a more…
xandout
  • 173
  • 2
  • 14
1
vote
1 answer

MavenCli - stdout, stderr

I have been trying to use MavenCli, giving it ByteArrayOutpurStream-s as stdout and stderr. I have tests that verifies some records were written to those streams. As long as I have one test, all is OK. But, if I introduce another test, it fails, as…
Ohad
  • 242
  • 3
  • 15
1
vote
1 answer

Maven Embedder - running hibernate3:hbm2java programmatically

** Update ** I have tried to reproduce the error and tried to create a Minimal, Complete, and Verifiable example. Unfortunately I cant even seem to reproduce the error myself (o my) even after performing restart from scratch technique... The…
Sander_M
  • 1,109
  • 2
  • 18
  • 36
1
vote
3 answers

Error when execute MavenCli in the loop (maven-embedder)?

What is the problem when I execute the maven command in the loop ? The goal is to update the version of pom.xml of the list of bundles. The first iteration, maven execute correctly (update pom.xml), but it makes error for all item after. for (String…
Nhu Phung
  • 79
  • 12
1
vote
1 answer

Set the logger for a Maven Embedder execution

I want to run a Maven compilation by my Java code. Thus, I've used the example of the usage of Maven Embedder explained here. This works pretty well, except that I want to redirect all the log written by the Maven Embedder to my own Logger. So, I…
Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
1
vote
1 answer

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:…
Djani
  • 13
  • 2
0
votes
0 answers

Is there a way to specify the JDK used by maven-embedder?

I'm using Maven Embedder version 3.9.3 in a project that dynamically creates, compiles, and deploys a Java archive. This works fine on my Mac, but when I try to run it on a Windows machine I run into problems. The Windows machine has two JDKs…
Ian Page
  • 1
  • 2
1
2