Mark Needham

Thoughts on Software Development

Archive for the ‘intellij’ tag

IntelliJ 14.1.5: Unable to import maven project

without comments

After a recent IntelliJ upgrade I’ve been running into the following error when trying to attach the sources of any library being pulled in via Maven:

Unable to import maven project

It seems like this is a recent issue in the 14.x series and luckily is reasonably easy to fix by adding the following flag to the VM options passed to the Maven importer:


And this is where you need to add it:

2015 09 30 00 18 17

Cmd + , -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing

Written by Mark Needham

September 30th, 2015 at 5:54 am

Posted in Java

Tagged with ,

IntelliJ Debug Mode: Viewing beyond 100 frames/items in an array

without comments

In my continued attempts at the Kaggle Digit Recognizer problem I’ve been playing around with the encog library to try and build a neural networks solution to the problem.

Unfortunately it’s not quite working at the moment so I wanted to debug the code and see whether the input parameters were being correctly translated from the CSV file.

Each input is an array containing 784 values but by default IntelliJ restricts you to seeing 100 elements which wasn’t helpful in my case since the early values tend to all be 0 and it’s not until you get half way through that you see different values:


It’s actually relatively easy to see the other values by right clicking on the array in question and clicking ‘Adjust Range’:

Screen shot 2012 11 25 at 22 59 42

Then I type in the end index of the array and we’re done!

Screen shot 2012 11 25 at 23 00 44

Written by Mark Needham

November 26th, 2012 at 4:28 am

IntelliJ: Find/Replace using regular expressions with capture groups

with 2 comments

Everyone now and then we end up having to write a bunch of mapping code and I quite like using IntelliJ’s ‘Replace’ option to do it but always end up spending about 5 minutes trying to remember how to do capture groups so I thought I’d write it down this time.

Given the following text in our file:

val mark = 0
val dave = 0
val john = 0
val alex = 0

Let’s say we wanted to prefix each of those names with ‘cool’ and had decided not to use Column mode for whatever reason.

One way of doing that is to capture the names and then replace each of them with ‘cool’ appended on the beginning:

A (very hacky) find regex could be this:


Where we capture all the letters in the variable name inside a group and then build our replacement string like so:

 cool$1 =

I always expect the capture group replacement syntax to be ‘\1’, ‘\2’ and so on but it actually uses a ‘$’ instead.

Hopefully now I shall remember!

Written by Mark Needham

March 30th, 2012 at 6:21 am

IntelliJ: Adding resources with unusual extensions onto the classpath

with 2 comments

We’re making use of MarkLogic and therefore xquery on the project I’m currently working on and recently wanted to add our xquery setup files onto the classpath so they could be used in a test.

We added them into ‘src/main/resources’ and set that as a source path in IntelliJ assuming that was all we needed to do.

Despite doing that our test kept failing because it couldn’t locate the files on the classpath.

Charles eventually came across the compiler resource patterns settings which are accessible from the Preferences > Compiler menu:


We had to add “*.xqy” to the end of the list of patterns to get our files picked up.

We came across another file extension that we needed to be on the classpath about 10 minutes later and obviously solved it much quicker that time!

Written by Mark Needham

June 9th, 2011 at 11:10 pm

Posted in Software Development

Tagged with

IntelliJ style item tracking in Visual Studio

without comments

One of my favourite features of IntelliJ is that it tracks the item that you currently have open on your Solution Explorer.

I thought this wasn’t possible in Visual Studio and had resigned myself to trying to remember which project each file was in. Luckily for me a colleague pointed out that it is in fact possible but is just turned off by default.

Tools > Options > Projects and Solutions > Check ‘Track Active Item in Solution Explorer’


Job done!

Written by Mark Needham

August 9th, 2008 at 2:51 pm

Posted in .NET

Tagged with , ,

Do IDEs encourage bad code?

with one comment

Although modern day IDEs (Eclipse, IntelliJ, Resharper etc) undoubtedly provide a lot of benefits when writing code, I am starting to wonder if the ease at which they make things possible actually encourages bad habits.

Useful features such as creating and initialising member variables from the definition of a constructor are quickly nullified by the ease at which one is able to create getters/setters/properties for these same member variables. All hopes of encapsulation gone with a few clicks of the mouse.

The counter argument is that you need to work responsibly when given a powerful tool, but it just seems to me that it’s hard enough to write good OO code (too hard maybe?) – anything which makes it harder is not a good thing!

I am convinced that IDEs need to provide an Office paper clip style Martin Fowler which pops up whenever you do something questionable (such as creating getters for every field on a class) and asks whether you really want to do what you’re doing.

Or maybe there is too much cranking out of the code and not enough thinking about the design of what we’re coding that’s the real problem…

Written by Mark

July 27th, 2008 at 11:43 am