Archive

Archive for the ‘Eclipse’ Category

Maven-Eclipse-Spring Integration

December 27, 2012 2 comments

In every new project I write I use maven and Eclipse. On most of these projects I use Spring as well – and I’m probably not the only one around doing it.

The problem I always run in to is how to configure everything to work properly – so once I finally got a properly working configuration, I had to write it down:

Simple Configuration – Maven + Eclipse
This configuration in your pom.xml will generate your .project and .classpath files (and a few more).

<plugin>
	<artifactId>maven-eclipse-plugin</artifactId>
	<version>2.9</version>
</plugin>

Slightly Advanced Configuration – Maven + Eclipse
This configuration will also automatically download sources and javadocs of any dependency you add into your project – very useful when working with open source software.

<plugin>
	<artifactId>maven-eclipse-plugin</artifactId>
	<version>2.9</version>
	<configuration>
		<downloadSources>true</downloadSources>
		<downloadJavadocs>true</downloadJavadocs>
	</configuration>
</plugin>

Spring Specific Configuration – Add Support in Eclipse
The additionalProjectnatures and additionalBuildcommands sections add the springnature and springbuilder to the project and allow you to get Spring specific highlights and notifications on your project (e.g. Icons on each class indicating if it is a Spring bean)

<plugin>
	<artifactId>maven-eclipse-plugin</artifactId>
	<version>2.9</version>
	<configuration>
		<additionalProjectnatures>
			<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
		</additionalProjectnatures>
		<additionalBuildcommands>
			<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
		</additionalBuildcommands>
		<downloadSources>true</downloadSources>
		<downloadJavadocs>true</downloadJavadocs>
	</configuration>
</plugin>

The Maven-Eclipse Plugin has a few more configurations and abilities, you can read more about it on http://maven.apache.org/plugins/maven-eclipse-plugin/

Advertisements

JADClipse is up and running!

November 12, 2012 6 comments

After a long time waiting, JADClipse is back on the market and fully functional with Eclipse 4.x.

Its home page can be found at: http://marketplace.eclipse.org/node/472922#.UKC1UodJ7D4

For some reason installing it from the Market place failed on my PC (Juno SR1) – but directly setting the update site to be http://feeling.sourceforge.net/update worked fine.

The new version comes with two built-in decompilers: “JD-Core” and “jad“.

One of the hidden upsides is that you no longer need to download “jad.exe” separately – the plug-in comes ready to work.

The only problem I observed so far is that the Output original line numbers as comments and the Align code for debugging options are not doing what they used to do. Perhaps this will be fixed in the future.

JADClipse – Debug Settings

Categories: Eclipse, Java, Tools Tags: , , , ,

Enabling ‘Pin to taskbar’ for Eclipse on Windows 7

May 13, 2012 Leave a comment

When installing Eclipse on Windows 7 it will not support the Pin this program to taskbar by default – for that you will need to do one simple thing: edit the eclipse.ini file.

You need to add the following to the begining of the file:

-vm
c:/Program Files/Java/jdk1.6.0_32/bin/

After restarting Eclipse the option will be available.

Two notes:

  • Replace the path to your JRE/JDK with the one in the example
  • There should not be any spaces before ‘c:/…’ – otherwise Eclipse will not start.
Categories: Eclipse, Java Tags: ,

Easy pasting of strings into Java code using Eclipse

April 8, 2012 Leave a comment

Ever tried to copy a PATH to your java code and end up needing to go into it and replacing all ‘\’ with ‘\\’ ?

Well – a coworker showed me a cool feature in Eclipse that automatically escapes text when pasting it , just go to:
Window –> Preferences –> Java –> Editor –> Typing and check the ‘Escape text when pasting into a string literal’ option. (See below image)
Now whenever you paste text into a string literal (anything that starts with “ and ends with a “) – Eclipse will automatically escape it for you.

This also works for ‘\n’ and any other escape character.

Example of what it does:
Lets say you want to print this text –

Hello everyone!
 this is a "sample" of pasting a '"' and a '\' in a string

In the code it will look like:

String text = "Hello everyone!\n" + "this is a \"sample\" of pasting a '\"' and a '\\'  in a string"

Note: This was written for Eclipse Indigo (3.7), future/past versions may differ.

Categories: Eclipse, Tools Tags: , , ,
%d bloggers like this: