So in my free time I do some hobby development, just for fun. And I thought, I could share this with the world. And it’s also a good way to show, how we work.
Let’s start with a brief introduction. We do a project. Agile. Very agile, because we do not have any plan, just a rough concept what we want to do. And as we go further, our concept changes and we do a lot of refactoring and re-working.
About the application: we will develop a “sipmle” application for handling of shipping notes. So we need a database, eventually a GUI for maintaining the data. And we do all this with Java. 🙂
OK, getting the project. We start with creating a simple Maven Java application. Why are we not starting with a webapp using maven’s other archetype? At the beginning we do not need any JSP site, and it’s not so difficult to enrich a Java application with a Web GUI (and reconfigure the project).
mvn archetype:create -DgroupId=biz.hahamo.dev.variations -DartifactId=variations
After we run a maven clean install, we get a jar executable, and let’s say, we try to run the simple application, we get… Yes, an exception.
$ java -jar target/variations-1.0-SNAPSHOT.jar Exception in thread "main" java.lang.NullPointerException at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Not the best, or? So we update the pom.xml with following lines:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>biz.hahamo.dev.variations.App</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build>
Line 10 tells that our Main Class is
— and adds it to the MANIFEST.MF file in the jar.
This for the first post. In the next posts we will describe the basic database schema, add data to the database (and we create the database), add a database handling layer, and so on. 😉
Of course: you can get the sources from GitHub. Eventually I’ll package each stage of the mini-project to avoid looking through each commit at the hub.