How to disable m2eclipse plugin that interferes with mvn command line build?

I am using the m2eclipse plugin in Eclipse to import a Maven project. The plugin reads pom.xml and sorts dependencies in projects in an Eclipse-friendly way, so I don’t look at the sea of ​​broken links and errors.

I use Eclipse to develop code, but usually I create projects from the command line, for example. msgstr "mvn clean install".

Unfortunately, when I do this, m2eclipse detects disk activity and tries to rebuild the workspace. This interferes with the build of the command line and sometimes leads to a race condition. For example, the command line may be in a clean phase, but does not work, because it tries to delete a file or directory that is locked during the rebuild of the workspace. Besides the fact that the restoration of the workspace is incredibly slow, and between the failed builds and the lost processor, my build process is 2-3 times longer than it should be.

You cannot use Eclipse (for example, to use Netbeans) or disable m2eclipse. This is a useful plugin except for this behavior.

So my question is: how can I stop m2eclipse from rebuilding the workspace all the time? Can I trigger the update manually and otherwise disable this behavior?

+4
source share
3 answers

As a quick fix, you can disable the Eclipse auto-build, disabling Project > Build Automatically

+2
source

The problem is that Eclipse detects that the compiled resources are gone and are starting to rebuild.

You do not need to run mvn clean install , but rather mvn install , since all your resources are already updated.

0
source

In addition to what dimitrisli said, I would suggest using different output directories for eclipse and command line.

You do this by defining a new profile (for example, "eclipse") and setting the output directory <outputDirectory>${project.build.directory}/classes-eclipse</outputDirectory> in that profile.

Thus, even if you build in parallel (from the eclipse and from the command line), they will not interfere with each other.

0
source

Source: https://habr.com/ru/post/1333170/


All Articles