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?
If you need to use it in your project, install it locally. Specify the file that contains user-specific configuration for Maven in the text field. If you need to specify another file, check Override option, click ellipsis button and select the desired file in the Select Maven Settings File dialog.
Click Run -> Edit Configurations -> Press + -> Search for "Maven" -> Locate "Command Line" field and enter in following maven commands "clean install" -> Press OK. Now click the green button to run that Run/Debug Configuration, this will maven clean install the module/project.
Go to File -> Settings and use the search bar to find maven settings. There you can find the maven version (usually against the field "Maven home directory" ).
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:
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:
Your build will now be correct.
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