Write custom maven command set using eclipse plugin

会有一股神秘感。 提交于 2020-01-06 14:40:33

问题


from command line I can write

mvn install -Pauto-deploy

Is it possible to store this command in my eclipse maven plugin. I want to execute this command by click.

I see only standart things in maven menu:

build
clean 
install 
test

I want see at this list my_autodeploy_command

I am sure it is possible but I don't know how.

Can you show how?

where can I write mvn install -Pauto-deploy ?

Somewhere here?

UPDDATE

for taringamberini


回答1:


The dialog is the correct one. Install, the lifecycle phase to run up to, is put into the goals field, your profile (auto-deploy) is put into the Profiles field (without -P):

You could also copy the full line (without leading "mvn") into the Goals field




回答2:


Is it possible to store this command in my eclipse maven plugin.

Yes, it is:

  1. In the Package Explorer view right click your Maven project
  2. choose Run as and Run configurations...
  3. right click on Maven Build (node added by your eclipse maven plugin) and choose New
  4. Compile the filed Name for example with clean_test_install
  5. Compile the field Base directory browsing your maven project directory
  6. Compile the field Goals for example with clean build test install
  7. click Apply and close the Run Configuration window

Now, in the tool bar, if you click on the drop down menu at the right of the Run As ... button you can see the clean_test_install entry.

UPDATE




回答3:


You can do it in maven plugin in eclipse as below. Go to debug configuration eclipse --> New configuration in Maven Build Specify Goals as clean -install and select base directory as project which you want to build. You can also skip test if we want in configuration




回答4:


I had an ugly/complicated maven command which launched my project. And On Windows, I wanted to launch it in eclipse - to see the console, and not under a command prompt - where you can't see the console clear. The Maven command was something like:

mvn -am -pl web package -DskipTests -P link-repo,tomcat-run,local-jive -Dfile.encoding=UTF8

So blackbuild answer: "You could also copy the full line (without leading "mvn") into the Goals field" saved my life!

I just copied the maven command in Goals field and it worked!



来源:https://stackoverflow.com/questions/22399145/write-custom-maven-command-set-using-eclipse-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!