Search code examples
javaeclipsemavenm2eclipse

Is it possible to get the exact maven command from an eclipse build process?


Short Version:
Is there a way to get at/inspect the command that Eclipse uses to build my maven project, in order to run that command from the command line?

Long Version:
I'm trying to set up an automated build/deploy process, which uses maven from the command line. Basically what I want to do is:

  • Run a Maven Build
  • Kill the running server
  • Delete the current .war and exploded directory
  • Copy built .war file to server
  • Start the server

The build process on my developer machine is tightly integrated with Eclipse. I've attached a server (Tomcat 6) which I can stop/start/publish etc all within Eclipse.

However when I build from the command line using mvn clean package (still on my development machine), the package that is built does not seem to build correctly (the build is successful, but encounters errors upon deployment).

Now I could probably spend some time trying to figure out the perfect command to get it properly working, but I figured that if it works within Eclipse, I could probably find the exact command that is needed. But I can't seem to find it.

Is it possible to get at this command?

System Info:

  • OS: Windows 7
  • Eclipse Version: Juno Service Release 2 (Build id: 20130225-0426)
  • Server: Tomcat 6.0.32
  • Maven: 3.0.5
  • Java: JDK 6.0_43

Solution

  • I think, that it's quite impossible, since Eclipse uses mostly API calls (even for compiling your project, if you use the m2e plugin), not calls to some shell scripts or applications. Of course you could request the API calls with some sort of profiling tools, but it wouldn't help you since you would have to implement the calls yourself.