Tuesday, 17 June 2014

Getting mvn setup to persist on a Mac

I installed Java and Maven on my mac.

The default Java install for mac worked fine and setup my JAVA_HOME etc., all fine.

I installed Maven and followed the instructions on my mac. (http://maven.apache.org/download.cgi)

Again fine...

Until I restarted my mac or created a new terminal.

Then I found the additional secret instructions, which I'd forgotten because I've been away from Unix for so long.

I needed to edit the bash profile.

As explained in this StackOverflow article "mvn-command-not-found-in-osx"

I needed to:

vi ~/.bash_profile

Then add the lines

export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1export M2=$M2_HOME/binexport PATH=$M2:$PATH

I skipped the JAVA_HOME because when I typed echo $JAVA_HOME in the terminal it had already been exported correctly. If you had to add the JAVA_HOME variable during your installation then you might need to add the export for that in your bash_profile as well.

Remember, with vi, to save the file, press 'esc' and then type ':wq'

esc :wq

I then opened a new terminal, and typed mvn and all was well.

Friday, 13 June 2014

Source code for Java For Testers Book Available on GitHub

I knocked off one thing on my todo list:

[x] release source code for Java For Testers book 

 You can find it over on github:

It will still change

The source code is likely to change in a number of ways:

  • package restructuring
    • I haven't decided if the current package structure supports the book reader or not
  • code will be removed
    • Some of the code classes are not relevant to the book. I use them because I have excerpts from them in the book, but some of them represent intermediate forms of the code in the book, rather than the final forms you find in most code repos e.g. classes without the methods yet, because I show the class without any methods in the text of the book
  • more code
    • I'm likely to add more code because I'm still working on the book. I'm doing my second draft at the moment, and I've been adding extra examples and more exercises, all of which require code.

This is the code in the book

I made a decision when I finished Selenium Simplified that I would never write another book with code in it, unless I had a way of 'pulling' the code out of my main code base, so that I would never have any more copy and paste, or find and replace, editing errors.

So I wrote a macro parser which scans my source code, extracts snippets to text files, and I include the text files in the book.

This means the code in the book is taken directly from the working code base.


I didn't want to release that code to the world as it isn't particularly readable since it has a whole bunch of nested macros in it.

And that was why I haven't released the source code until now.

I expanded my macro processor to kick out a version of the code base without the macros, and that is what I have released to github.

More to come

I'm still working on the edits for the book. So the code will change. As will the book.

The book "Java for Testers" is available to purchase from leanpub with a starting price of $4.99 (I really must get around to increasing the price - perhaps when I've finished my edits)