7

In my project when I go to the cmd line and type:

mvn package

It creates a single fat .jar file in my /target directory.

I am using maven shade plugin.

I want to be able to do this in IntelliJ, so in my run configurations for maven, I set the working directory to the root pom.xml folder, and I added the command line 'mvn package'.

It doesn't produce the same output, it just has:

classes
generated-sources
generated-test-sources
test-classes

What am i doing wrong?

Blankman
  • 259,732
  • 324
  • 769
  • 1,199
  • When you issue an mvn command you normally have a console output, what does it say in it? – fge Jun 14 '13 at 18:59
  • good catch, it says `Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format : or : – Blankman Jun 14 '13 at 20:08

1 Answers1

31

As the error states, you have entered an erroneous lifecycle since you also included the mvn command itself. That command will be implicitly called (since this is a maven run configuration).

This is what you've got:

enter image description here

This gives you something like this as an error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.118s
[INFO] Finished at: Sun Jun 16 15:47:29 CEST 2013
[INFO] Final Memory: 6M/120M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]

So just remove the mvn command and make it look like this:

enter image description here

Your build will now be correct.

maba
  • 47,113
  • 10
  • 108
  • 118