Aug 162012
 

It happens quite regularly that I need to extract a JAR or WAR file for a brief inspection. Of course I can do it on command line however, when operating in Finder I wanted to get something that just unarchives a selected file by mouse click. 

To achieve this I used for the very first time Automator, a tool I didn’t really think would be providing a solution to any of my needs. What I did do:

  • Open Automator
  • New > Service
  • In the drop down menus choose in Service receives selected files or folders in Finder.app
  • In Actions search for Run Shell Script and double click on it
    • enter this as command line unzip -n “$1″ -d “$1″.zip
    • select for Pass input as arguments
  • Click on Save and give a name, e.g. Extract Archive

To verify:

  • Open Finder
  • Right click any archive
  • In the context menu select Services > Extract Archive

Note: As a filetype cannot be selected the menu is available for all files and folders. If you select something that is not a extractable with unzip you’ll see an error message.

Popularity: 3% [?]

Tags: , , , ,
Apr 272011
 

I was not happy about to realize that one of the last Apple updates updated maven to version 3. Maven in it’s new version does brake quite a few concepts which were in version 2, and maven does not go for downwards compatibility.

I had no issues with simple builds, but when I had a multi-module project which requires jars to be installed in the repository maven 3 just started throwing exceptions at me. As my clients still are on maven 2.0+ I was looking for a solution how to downgrade it.

It actually is fairly simple as the update adds a new maven version and modifies the default executable but it doesn’t uninstall previous versions. These steps will give you back what was yours before:

$ cd /usr/share/java
$ ls -q1 | grep maven
#check if your desired maven version is there
apache-maven-2.0.9
maven-2.2.0
maven-2.2.1
maven-3.0.2

$ cd .. #go up
$ ls -l | grep maven
#check what current version is
maven -> java/maven-3.0.2
$ sudo rm maven #remove unwanted symlink
Password:
$ sudo ln -s java/maven-2.2.1 maven #set it to maven 2.2.1

That’s it. To test out if it runs or not just reopen Terminal and enter mvn -version and it will be now version 2.2.1 :)

Popularity: 54% [?]

Tags: , , , ,