Configuring Eclipse Preferences

I find that by default the Eclipse colours are far too subtle to actually see properly. But once configured the workspace will be easier to navigate and problems and code will be clearer.

 

Changing Eclipse Preferences

Click Window → Preferences → The preferences panel will appear. Drop down General → Appearances and select Colors and Fonts. Drop down the Basic folder. Check that “Error text colour” is bright red. Now drop down the Java folder and select “Coloured labels – write access occurences.” Change the colour from the pale beige to something bright! I like bright green (RGB 0, 219, 0).

Click apply.

 

Still in Preferences panel, drop down General → Editors → Text Editors. Change the “Undo history size” from 200 to 500. Tick “Show print margin” and change the “Print margin column” from 80 to 200. Make sure “Show line numbers” is ticked! In “Appearance color options” select the “Find scope” option and change it from grey to something bright (I like bright yellow).

Click apply.

 

Still in Preferences panel, drop down General → Editors → Text Editors → Annotations. Select “Occurrences” and make sure the colour is something bright (I like bright green again). Select “Write Occurrences” and make sure the colour is something bright (I like bright orange). Select Errors and make sure the colour is something bright (I like the hot pink).

Click apply.

 

*If you have Checkstyle installed*

Select “Checkstyle warning (both if there are two) and make sure the colour is something bright (I like deep blue – that way you’ll be more inclined to fix the issues!)

Click apply.

 

Those are my basic checks and changes. If you have others, feel free to comment.

Click ok.

 

What does it look like?

In the following example above I have selected varargs and highlighted is where varargs is used (green) and where its first declared (orange). Also on the side bar to the right are the lines that the selected text is found. They now stand out enough from the side bar that you can see them and select them. We can also clearly see the error on the last line of the bottom for look. Again that is highlighted in the side bar and can be clicked on.

*For the Checkstyle warning colours see the article on Checkstyle*

m2eclipse plugin error message

I’ve been installing Eclipse with all of the plugins I usually use nowadays (m2eclipse, checkstyle, etc.) but had encountered a problem after installing m2eclipse. The error was as follows:

Could not calculate build plan: Missing:
----------
1) org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1
Try downloading the file manually from the project website.
Then, install it using the command: 
mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.1 -Dpackaging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there: 
mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
----------
1 required artifact is missing.
for artifact: 
org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1
from the specified remote repositories:
central (http://repo1.maven.org/maven2, releases=true, snapshots=false)

Rather non-descript error there. Had a quick google around and there are a few people posting similar error messages but none of the pages had an answer on how to fix it. I checked the .m2eclipse file to make sure it was correct, which it seems to be. And then I had a bit of a brain wave! (Unusual yes). Every post I’d seen had mentioned that the plugin was definitely in the repository, but Eclipse was claiming it couldn’t find it. So I checked ZoneAlarm and deleted all entries that didn’t have Access-trusted and internet. Lo and behold, Java™ Platform SE binary pops up a dialog box straight away and when I allowed it access, Eclipse began to download successfully from the repository!

But the error is still there… So attempt 2, add the plugin to the plugins tab, but move the plugin to the next version 2.4.2.

<plugins>
  	<plugin>
 		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-resources-plugin</artifactId>
		<version>2.4.2</version>
	</plugin>
</plugins>

The error is now gone, but not sure this is the best solution, so if anyone can think of a better one, let me know!

Anyway hope this helps someone else with this error message.