Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stop automatic building with maven / eclipse

Tags:

eclipse

maven

We are using maven with eclipse. We have a multi module project, quite big.

Eclispe-Maven integration seems to decide by itself when to react building dependent modules, and that is being a pain.

I have turned on automatic building but that doesn't seems to make any changes.

There are certain actions such as: deleting a resource, or launching a module, that will trigger a build of another module.

How can that behavior be turned of? I prefer to call maven manually as required.

like image 872
Rafael Avatar asked Oct 16 '11 10:10

Rafael


People also ask

What is run as Maven build in Eclipse?

You can Launch Maven builds from within Eclipse. It does the dependency management for Eclipse build path based on Maven's pom. xml. It resolves Maven dependencies from the Eclipse workspace without installing to local Maven repository (requires dependency project be in same workspace).

Is Maven inbuilt in Eclipse?

Most Eclipse IDE downloads already include support for the Maven build system. To check, use Help About and check if you can see the Maven logo (with the M2E ) sign.

How to Run simple Maven project in Eclipse?

Finally, with a modern version of Eclipse, just do "Import > Maven > Existing project into workspace..." and select your pom. xml. M2e will automatically manage your dependencies and download them as required. It also supports Maven builds through a new "Run as Maven build..." interface.


3 Answers

Just go to Project in top bar than uncheck "Build Automatically". It will stop auto building the project and saves your precious time.

like image 94
amit sharma Avatar answered Oct 17 '22 15:10

amit sharma


Ziesemer's solution will indeed deactivate Maven building though I think it will come with some rather undesirable side-effects when you get to execute the code in Eclipse for debug or tests. Problem will be that some resources will not be present as the builds will not have run to copy and filter them as expected. this leads to some unpleasant phantom bugs and hours wasted if, like me, you tend to forget to run the maven build manually each time you need to run the code.

close unneeded projects When you have a working copy of your projects perform a

mvn clean install
This will install all the dependencies in your local repository. Once done simply close the projects you do not need and only leave open the ones you are working on. this will force maven to resolve the projects from the local repository rather than the workspace. By doing so it will not trigger a build of dependencies.

deactivate workspace resolution you can also achieve a similar effect by clicking on a project and deactivate the workspace resolution. This will force maven to perform repository resolution and bypass the build. However if you change multiple projects you must ensure they are installed to the local repository first otherwise the other projects will not see the changes. May also require a manual jolt to the project to resolve dependencies especially if you are not using SNAPSHOT build version.

split project further Another alternative would be to split your project in multiple modules, each having modules of their own. This will create a deeper hierarchy, which has negative side effects of it's own, but it will allow you to keep only one set active in your environment. Again, make sure you have installed the other set(s) to your local repository for the resolution to work correctly.

Hope this helps.

like image 31
Newtopian Avatar answered Oct 17 '22 17:10

Newtopian


Right-click on the project you are trying to disable the automatic Maven builds for, click "Properties", then click on "Builders" from the left-hand navigation. There should be a "Maven Project Builder" there that you can uncheck to disable it.

I'm not sure if this is exactly what you're looking for. I also have never really operated like this myself, so I can't speak to any of the side-effects you may encounter - though Eclipse warns you about this itself: "This is an advanced operation. Disabling a project builder can have many side-effects. Continue?".

Assuming your project is in some sort of version control, make sure that only your pom.xml and not your Eclipse .project file nor .settings folder are in source control before doing this. (If so, be sure not to commit them back.) The rest of your team probably wouldn't want this builder disabled for the entire group. :-)

like image 5
ziesemer Avatar answered Oct 17 '22 17:10

ziesemer