Upgrading Nexus on Linux
It has been way too long since I installed Nexus the first time. I decided it was time for an upgrade. Upgrading Nexus on Linux is a follow up on an earlier post.
Since version 1.4 which was the version I originally installed (http://www.thedaytodayjava.com/frameworks/maven/nexus-simple-installation-on-linux/), "a couple" of versions has been released.
Nexus is now running at version 2.2. I feared upgrading nightmares..
After having read the documentation and release notes for all the versions, I decided to skip directly to version 2.2, and this is how I did it:
# While logged in to our dev server cd /tmp # Get nexus wget http://www.sonatype.org/downloads/nexus-2.2-01-bundle.tar.gz # Unpack tar xvzf nexus-2.2-01-bundle.tar.gz # Move it to wanted install dir mv nexus-2.2-01 /usr/local/ cd /usr/local # Create symb link to nexus ln -s nexus-2.2-01 nexus # Add path to nexus in global profile emacs /etc/profile # Make nexus executable cd /usr/local/nexus/ chmod -R a+x bin |
First step done, the next step was to get it running as a service again.
# Copy default settings file and make it executable cp /usr/local/nexus/bin/nexus /etc/init.d/nexus chmod 755 /etc/init.d/nexus |
# Make sure its added to the init defaults update-rc.d nexus defaults # Edit the nexus settings emacs /etc/init.d/nexus # Set your nexus home: NEXUS_HOME=/usr/local/nexus # Set local path to Java (i needed to do this, got a zip stream exception) JAVA_HOME=/usr/local/java PATH=$PATH:$JAVA_HOME/bin |
Now start the service using: service nexus start and tail the log file in /usr/local/nexus/logs/wrapper.log
The upgrade was hellishly easier than expected. A great improvement must be that the config automatically figures out which environment its running on, and chooses the correct settings in the jws folder.
Sonar, simple installation on Linux
When I started using Hudson CI Continuous integration server, one of the first things I did was creating a Maven site build. The goal was to do code analysis and get test coverage. I had no knowledge of Sonar, so I did it the oldschool way. Configured surefire, cobertura, findbugs maven checkstyle and added them as plugins in Hudson. Running the site build took about an hour and gave me some decent results.
The problem was that I still felt I was lacking a bit of knowledge about my code. A former colleague of mine suggested Sonar. I did not take long until I realised I couldn't wait to try it out.
Here is how I installed Sonar on our Debian Linux development box:
Did the in-memory database integration testing work as expected?
On my previous post about integration testing with an in-memory database without hibernate I was in the process of finding out which frameworks to use and which in-memory databases to use.
We are now using h2database with Unitils and generated sql schemas for integration testing. H2Database was chosen because it supported most of the syntax and functions/procedures we have in our Firebird database.
The major challenges with this approach is maintainability with the sql schema. I haven't found a good solution for this yet, so we have to update the test schema every time there are changes in the database schema.
Further I will show you a short summary of the setup:
Integration testing with an in-memory database without hibernate
On previous projects I have been using hibernate as persistence framework, but now the layout is Ibatis with a relational database. Setting up an integration test stack with hibernate is easy, just some configuration of an in-memory database with HSQLDB or H2Database and your good to go. The niftiest about this is the lacking need of a database schema and conversion of fields, types, generators, procedures and so on.
So, whats your choices? using Google as your friend, you will find keywords like DbUnit, HSQLDB, Hibernate, Unitils, Apache Derby, JavaDB, Hibernate, Hibernate, Hibernate....
Whats the best option? I'm not sure myself, but I will give one framework a go, and post about the experiences later.
Unitils with HSQLDB here we go. Btw, Unitils builds on top of DbUnit and integrates easily with JUnit, Spring, EasyMock etc. Just what i need??
Need to get data from your pop/imap accounts?
Yesterday I needed to get some data from a number of email accounts, and of course googled it a bit before I started. Our current system had support for this, hence using Java Sockets and commands to the email server. This proved to be slow and not accurate.
Java ships with a built in API for this, the javax.mail. The goal was to instantiate a connection and get the total quota and used quota for an account.
Update for common web module
A couple of bugs was found in my post about common web module. I wanted to use this module not just for war overlay, but also a common module for classes. This was not handled by the setup i posted earlier. The solution to this problem was:
<!-- In the common-web module, this has to change --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <attachClasses>true</attachClasses> <!-- This line is needed to generate a jar file to use as a dependency in other modules --> <!-- Then in the module you want to use this dependency --> <dependency> <groupId>${project.groupId}</groupId> <artifactId>common-web</artifactId> <version>${project.version}</version> <classifier>classes</classifier> <!-- This is needed because the jar file generated using attachClasses is prefixed default with -classes.jar --> </dependency> |
Thats it, keep enjoying the war overlays!
Nexus, simple installation on Linux
Some weeks ago I got tired seeing Maven connecting to all those repositories online to check for new versions of dependencies. Not just that, but also the hassle of installing all those "not in any maven repository" dependencies. This had to be done each time I wanted a Hudson build to have it's repository, which is a good idea if you want to run simultaneous builds using different profiles.
I decided to install Nexus.
Creating a common web module using Maven
Working with two different web-apps, with a common source base, often very similar web functionality and sometimes the need to have common sources made me hunt down how this could be done. As we are using Maven for project management, researching this ended up in war overlays. This is a nice Maven feature and in fact very simple to implement. Keep reading to see how I implemented overlays..
Day to day Java
As a lead developer and architect at my company, I encounter different kind of problems every day. This blog will be about different types of topics related to the everyday development mostly related to Java.
Ibatis, why are my queries extremely slow?
For a while now I have been scratching my hair off trying to figure out why some of my queries were running extremely slow. At first I started analyzing the java code, creating a generic timer monitor for all my struts2 actions using AOP to pointcut all the different method calls in the stack and displaying them in a tree like fashion.
Analyzing this result didn't leave me any wiser. It only proved that the queries were and which queries were running slowly.