Sunday, June 10, 2018

Clean the workspace .metadata folder on product startup

Leave a Comment

I develop an Eclipse plugin which extends to Eclipse UI, and we deliver it as a whole Eclipse product. The plugin has as a target some automotive projects.

The version of the product can be configured from the project and executing a batch file will launch the proper version of the product.

So the final command will be something like this:

start /B %PRODUCT_PATH%/eclipse.exe -clean -configuration %PATH_TO_PROJECT_CONFIG% -data %PROJECT_PATH 

The problem comes when switching from one product version to another, the .metadata folder is corrupted or the information from it is not compatible between products, I am not sure what happens exactly but I get sporadic exceptions at startup.

When I clean the .metadata and launch the product without an existing .metadata folder in the project location, everything runs normally.

Is there an command line option for Eclipse to clean the workspace .metadata before startup?

1 Answers

Answers 1

All (I think!) the Eclipse command line arguments can be found in the Runtime options section of the reference documentation.

I find nothing in that document about removing the .metadatadirectory.

I have also searched for usage of the words "clean", "clear" and "remove", and reference to osgi.instance.area (which and think is the OSGI term for the .metadata directory) and found nothing that seems relevant.

Suggestion 1: clearPersistedState

You could try -clearPersistedState option. Maybe that could help? (I don' really know the purpose of the option, I just found it in the documentation.)

Suggestion 2: Start script

Otherwise maybe you could have a start script which simply runs del to remove the directory.

Suggestion 3: Find the root cause

The best thing to do is of course to find the root cause of the startup problems and solve that. But maybe that is too time consuming or impossible in your case.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment