在Eclipse中自动安装Maven项目 [英] Automatic Install of Maven Projects in Eclipse upon Build

查看:125
本文介绍了在Eclipse中自动安装Maven项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让eclipse在构建项目时自动运行mvn install(例如,当项目中的源文件被更改时)?

Is there a way to let eclipse automatically run 'mvn install' when it builds a project (e.g. when a source file in the project is changed)?

我的目前的问题是,我有大量的日食项目,每个都是一个Maven项目。项目依赖于Maven依赖关系,但不是父/子项目。

My problem at the moment is that I have a large number of projects in eclipse, each of which is a Maven project as well. Projects depend on each other through Maven dependencies but are not parent/child projects.

我的解决方法是在后台运行一个bash脚本,它检查所有的更改这些项目的目录,并为每个更改的项目触发mvn install。不幸的是,这会产生一些问题,因为一些项目我也必须调用mvn clean,这使eclipse项目不可用,直到我在eclipse(Maven - > Update Project ...)中手动重建项目。

My workaround is that I have a bash script running in the background which checks for changes in all directories for these projects and triggers 'mvn install' for every changed project. Unfortunately, this creates some problems since for some projects I have to call 'mvn clean' as well and this makes the eclipse projects unusable until I manually rebuild the project in eclipse (Maven -> Update Project ...).

推荐答案

您是否尝试Eclipse构建器?

Did you try Eclipse builders?

您可以附加构建器到您的不同项目。

You may attach a builder to your different projects.

构建器将在每次构建相关项目时调用您的bash脚本。

The builder will call your bash script each time its related project is built.

请参阅以下文章以供参考:非蚂蚁项目建设者

See the following article for reference: Non-Ant project builders

这篇关于在Eclipse中自动安装Maven项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆