Maven, the better quickstart

I read a lot of Maven documentation and at the end the most interesting question “How do I run an application with its dependencies?” wasn’t answered. Instead I was flooded with many xml configuration sections without showing a simple and complete configuration file. That’s why I wrote this howto but first a little story.

I came across Ivy and Maven a couple of days ago, both of which make it very easy to add a list of libraries to your Java project and add them to the classpath.

Basically both look for a project configuration file including your dependency list and they download the libraries from the internet and install them in the local repository ~/.ivy2 for Ivy and ~/.m2/repository for Maven which are then shared with your Ivy/Maven projects.

While Ivy is only a dependency manager which is integrated with the most popular build management system for Java projects (Ant), Maven is more than just such a manager. With Maven you have a build system and a dependency manager in one tool.

I focused on Maven and it took me a while to find out that a feature I was looking for wasn’t there natively. I assumed it would have a similar behaviour than Ivy but it hasn’t and works completely different.

I was missing a clear Maven howto which shows in 5 minutes how your project is created, compiled, packaged and especially how your standard java application is run afterwards.

I assume that Maven is already installed and that you are familiar with using a shell as I won’t use m2eclipse, the Maven integration for Eclipse. Maybe I’ll update this post later and give you a little introduction but for now let’s concentrate on using it in a shell.

I don’t guarantee that everything is 100% correct because I don’t use Maven that long. Post a comment if something is wrong.

Continue reading »

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

What’s Erviz?

Note
I’m in the process of forking Erviz. The fork is almost done. The Linux packages are prepared and almost ready to be submitted. (27. Sep 03:47 UTC)
————————

Erviz, written by Mitsuru Kono, is a tool that makes it easy to create entity-relation models and the best thing it’s free!

You can run it on Windows, Linux and Mac but for the latter a patch is required which will be discussed later on this page.

Creating the entity-relation diagram

Only these two steps have to be followed:

  1. Create a text file and define all your entities and relationships. The syntax is simple as example shows:

    # Using Erviz 1.0.6
    {title: "Syn2Stock ERD V3"; title-size: 20}
    
    # Entities
    
    [Item] {color:red}
     *Item ID
      Type
      SimpleItem
      Bar Code
      Name
      Amount
      Owner
      Comment
      Attachments
      Sources
      Source ID*
      Location ID*
      Lending ID*
    
    [Source]
     *Source ID
      Price
      Homepage
      Manufacturer
    
    [Location]
     *Location ID
      GPS Coordinates
      Name
      Room
      Locker
    
    [Lending]
     *Lending ID
      Borrowed by
      Borrowed on
      Returned on
      Reminder ID*
    
    [Reminder]
     *Reminder ID
      Start Date
      Repeat Interval
      End Date
      Active
      Action
      Email
      Phone
      Message
      Item ID*
      Lending ID*
    
    [Event]
      *Event ID
      Event Type
      Date
      User
      Item ID*
    
    [Attachment]
     *Attachment ID
      File
      External URL
      Private
    
    [Electronic Part] {color:orange}
     *Electronic Part ID
      Value
      Item ID*
    
    [Book] {color:orange}
     *Book ID
      Subtitle
      Author
      Publisher
      Paperback
      Language
      Review
      Summary
      About the Author
      Item ID*
    
    # Relationships
    [Item] *--* [Source]
    [Item] 1--1 [Location]
    [Item] 1--* [Lending]
    [Item] *--* [Attachment]
    [Reminder] ---- [Item]
    [Event] *--1 [Item] <contains ->
    [Electronic Part] ---- [Item] <is a->
    [Book] ---- [Item] </is><is a->
    </is></contains>
    
  2. Then turn the text file into the ERD image by calling the convert-files script.

Continue reading »

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

WebService.class not found

[javac] An exception has occurred in the compiler (1.5.0_18). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
[javac] com.sun.tools.javac.code.Symbol$CompletionFailure: file javax/jws/WebService.class not found

If you get such an error the JSR 181 is missing.

I added the following Ivy dependency to fix the issue while I’m using http://mvnrepository.com/artifact as my repository root.

<dependency org="javax.jws" name="jsr181-api" rev="1.0-MR1"/>
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

How does the MIDI Scooter work?

I saw this video on youtube

On the developer’s blog the scooter’s operation is described as:

A brief summary of what exactly is going on here:

  1. Laptop program parses a MIDI file and I choose three tracks that look interesting.
  2. XBee radio streams MIDI data wirelessly to the motor controller.
  3. Motor controller uses the frequency of the MIDI note as the PWM frequency.
  4. Each phase corresponds to one MIDI track. Three phases can play three tracks simultaneously.

For kicks, here’s the code for both ends of the system.

Because the PWM frequency is independent of the motor speed, this all happens more-or-less in the background while the regular motor control algorithm runs in the foreground. Meaning, I can ride the scooter around at low speeds without noticing any difference in performance. At high speeds, when the note frequencies get close to the commutation frequencies, bad things would happen.

I still don’t get it how it actually works with the motor signal. If he’s converting the tone frequency into a pwm signal he’s changing the resulting energy that he gives to the motor so the speed is also changing in contradiction to his statement the PWM frequency is independent of the motor speed. If he’s modulating a pwm signal onto another the resulting energy also changes. I also don’t know where the sound is actually coming from. Is there a speaker or is he using the motor as a kind of speaker? oO

Any ideas of what’s going on there?

I’m not that much into mechanicals so a block diagram would have been nice.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Eclipse, Axis2 and Tomcat

If you are looking for a howto for that toolchain you’re wrong here. If you are here because you’ve got the same/similar problem than me, go on.

While I was following step 6 in this tutorial I got the following error.

Result: Failed while installing Axis2 Web Services Core 1.1

This forum wasn’t useful for me so I updated my Axis2 to the latest release 1.5.3 and checked the axis2 and tomcat preferences. The web service runtime was unfortunately set to Apache Axis so I changed it to Apache Axis2.

I did step 6 of the tutorial again while I deselected Javascript in the Project Facets dialog this time and it happily worked. Then I created another project with Javascript selected but I got the same error from above again. From that point on the error alway appeared regardless the Javascript selection. No chance to get rid of that error message.

Does somebody experience the same? Any workaround?

Update 1:

I downgraded to Eclipse Java EE IDE for Web Developers (Build id: 20100218-1602, Galileo) but this time eclipse hanged up while I was creating the Dynamic Web Project. The process “waiting user operation” stuck. I updated the packages (Help > Check for Updates) and only an xml problem appeared which seems to not be a big problem as I was now able to create a project without any error messages.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare