12

I have a maven plugin generating some code for eclipse to build, but I have to manually refresh the project before eclipse sees the code.

How can I make eclipse automatically refresh the project as part of the build?

I'm trying to use a custom builder, but it wants to run a command (which I don't need to do).

ScArcher2
  • 85,501
  • 44
  • 121
  • 160
  • 1
    A similar question exists and has a response : It is related to [Eclipse 3.7] http://stackoverflow.com/questions/7073348/auto-refresh-eclipse-project-upon-folder-update – Stephan Jun 01 '12 at 12:27

3 Answers3

10

You can make eclipse automatically refresh your whole workspace: Window->Preferences->General->Workspace and check "Refresh automatically"

Avall
  • 850
  • 1
  • 5
  • 14
  • I think that only refreshes on startup and shutdown. I tried it and it did not automatically refresh it after I did a project / clean. – ScArcher2 Oct 15 '10 at 19:59
  • I use it daily, since I use ant-scripts and other external programs to modify the content of my workspace, and it works fine for me. I do however not know how it works; if it continuously polls the directory tree (and how often) or something smarter... – Avall Oct 16 '10 at 09:35
  • In Eclipse Indigo there are several options `Refresh on access` and `Refresh using native hooks or polling`. – Matthieu Jul 21 '15 at 08:57
3

you can make it project/build specific for external builders under Project Properties->Build->Refresh Policy. Here is an example for C/C++ builds.

enter code here

J-Dizzle
  • 4,861
  • 4
  • 40
  • 50
2

Depending on how you run your Maven plugin, it may just refresh the project automatically. That is how it normally works in m2eclipse.

Also, you can configure a custom builder Project Properties / Builders / New... / Program and select some dummy command to run (e.g. C:\cygwin\bin\date.exe) and then configure project refresh settings.

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67
  • I tried this, but It needs to work across platforms. I don't know that I can enter a dummy command that will work with Windows, Linux, and Mac OSX. – ScArcher2 Oct 15 '10 at 16:28
  • If you have cygwin installed on Windows, an sh script may work. But then again, how are you running your maven plugin in a first place? – Eugene Kuleshov Oct 15 '10 at 16:36