在 Eclipse 中缺少“maven package”菜单项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9422142/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Missing the ‘maven package’ menu entry in eclipse
提问by xZise
I'm using Eclipse 3.7 with m2eclipse. Previously I know there was a menu entry ‘maven package' but since I reinstalled Ubuntu there is no entry and I have to ‘maven install' to do the same.
我将 Eclipse 3.7 与 m2eclipse 一起使用。以前我知道有一个菜单条目“maven 包”,但自从我重新安装了 Ubuntu 后,就没有任何条目,我必须“maven 安装”才能执行相同的操作。
Now I'm wondering if it is possible to get the ‘maven package' back so I could test something without installing it and allow other projects to use the test version as dependency.
现在我想知道是否有可能取回“maven 包”,这样我就可以在不安装的情况下测试某些东西,并允许其他项目使用测试版本作为依赖项。
回答by JB Nizet
Just use Maven Build...
and type package
in the goal field.
只需使用Maven Build...
并输入package
目标字段即可。
回答by akcasoy
I also recently wanted to have this option with the new version of m2eclipse. The best solution i could find is, to create a configuration with the goal package, and as base directory give a variable name ${selected_resource_loc}. Still you have to go to run configurations page, but at least you don't have to define a new configuration for each project, but use the predefined one.
我最近也想在新版本的 m2eclipse 中使用这个选项。我能找到的最佳解决方案是,使用目标包创建配置,并作为基本目录提供变量名称 ${selected_resource_loc}。您仍然必须转到运行配置页面,但至少您不必为每个项目定义新配置,而是使用预定义的配置。
- right-click project
- run as
- run configurations..
- double click maven build (to create a new configuration)
- give a name for configuration e.g. package
- click variables
- select "selected_resource_loc" and click ok
- write your goal e.g. "package" or "clean package"
- run
- 右键单击项目
- 运行方式
- 运行配置..
- 双击 maven build(创建新配置)
- 为配置命名,例如包
- 点击变量
- 选择“selected_resource_loc”并点击确定
- 写下你的目标,例如“包”或“干净的包”
- 跑
The next time when you want to package another project, you can use this configuration again:
下次要打包另一个项目的时候,可以再次使用这个配置:
- right-click project
- run as
- run configurations..
- select your maven configuration
- run
- 右键单击项目
- 运行方式
- 运行配置..
- 选择你的 Maven 配置
- 跑
At least you will not have to create a new configuration each time you want to package, as with maven build...
至少你不必每次要打包时都创建一个新的配置,就像 maven build...