Awwww, Maven, you kill me, you really do!!
You maintain your Maven project its documentation in a simple XML dialect called xdocs. It's then transformed to HTML and copied to the project its website. A colleague updated documentation and then did a "maven multiproject:site site:deploy". He saw that the generated HTML documentation wasn't updated. Except it was. Look at the following source:
<?xml version="1.0" encoding="utf-8"?> <document> <properties> <title>Release notes</title> </properties> <body>
<subsection name="SuperProject-2.5.2-build04.ear"> .... </subsection>
<section name="Releases SuperProject">
<subsection name="SuperProject-2.5.1-build01.ear"> ... ...
Notice the error? The <section> tag is placed below the <subsection> tag. Why in hell this validates is unclear to me. Is it validated in the first place? TELL ME IT IS!! Another manhour or two wasted.
After firewalls are in place, you're not done securing JBoss 3.2.6. At the least, passwords should be set on the jmx-console and web-console applications.
Go to $JBOSSHOME/server/yourconfig/deploy and take the following steps to secure the jmx-console application:
Now do the same for the web-console application:
Besides the above steps, you'll probably want to remove the status application, the HTTP invokers, maybe JMS, etc. An excellent book is O'Reilly's JBoss, A Developer's Notebook. Chapter 9 is freely available online, which walks you through the above steps and much more.
(Re)start JBoss and go get your brownie points from the system administrators!
Every now and then you'll make a mistake while updating firewall rules and lock yourself out. There's a nice trick to avoid this, if you're disciplined to take the following steps:
If the new firewall rules lock you out in step 4, you won't be able to remove the scheduled update and the old rules will be loaded in 30 minutes or so!
Thanks to an experienced sysadmin for this tip...
ibiblio.org was offline today. This meant my build didn't work. Of course, no error was given, which we've come to expect from Maven ;)
All it said was:
$ maven jar:install __ __ | \/ |__ _Apache__ ___ | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~ |_| |_\__,_|\_/\___|_||_| v. 1.0.2 Attempting to download one-of-our-libraries.jar.
Then it just kept waiting and waiting.
So after one of the developer wasted an hour or so finding out what the hell goes wrong, he walked to one of the sysops. This clever sysop got the luminous idea to ping ibiblio.org. Offline... After that, it was a quick fix to temporarily remove ibilio from the remote repository line in the project.properties.
This goes to show how important it is to display understandable errors for the user. Come to think of it, this goes to show how you should try to catch errors and see if there's a way to continue.
And why the flying freak is this thing looking on ibiblio for our proprietary libraries?
Today, I'd like to talk to you about Maven and rights. Maven must be able to deploy to a central place, the remote repository. We'll do this using sftp. Now look at the following output:
jar:deploy: [echo] maven.repo.list is set - using artifact deploy mode Will deploy to 1 repository(ies): R1 Deploying to repository: R1 Using private key: /home/user1/.ssh/keytest Deploying: /home/user1/blah/myproject/project.xml-->myproject/poms/myproject-3.6.1-build01.pom Failed to deploy to: R1 Reason: Error occured while deploying to remote host:repository.company.com:null BUILD FAILED
The problem turned out to be a rights issue: the file already existed, but wasn't writeable:
$ cd /var/www/repository/maven/ZIG/poms $ ls -l myproject-3.6.1-build01.pom -rw-r--r-- 1 user2 users 3870 Nov 23 16:42 myproject-3.6.1-build01.pom
Don't you just love this stuff? Only took about two hours. For three teammembers.
Maven, oh, Maven. Funny how much bugs this package brings up. And I don't mean its own bugs!
In the previous post, I discussed "deploying", which is Maven speak for building a jar/war/ear of your project and then copy it to a server where other dependant projects can get it.
This works. However, I documented this procedure using scp. Today I had to configure a project which used the exact same properties, but uses sftp. Of course, Maven flunks out with a NullPointerException (wouldn't you?).
java.security.NoSuchAlgorithmException: DH KeyPairGenerator not available java.lang.NullPointerException at com.jcraft.jsch.jce.DH.getE(Unknown Source) at com.jcraft.jsch.jce.DHG1.init(Unknown Source) at com.jcraft.jsch.Session.receive_kexinit(Unknown Source) at com.jcraft.jsch.Session.connect(Unknown Source)
I checked out that same project locally and Maven did work fine here. But not on the shared development box. Difference? Locally, J2SDK 1.4.2 build 08 was installed and on the development box, version 1.4.2 build 03 was installed. There was a difference of a few files and besides font.properties stuff, they were related to security:
$ diff list_j2sdk142_03 list_j2sdk142_08 < ./jre/lib/old_security < ./jre/lib/old_security/cacerts < ./jre/lib/old_security/java.policy < ./jre/lib/old_security/java.security < ./jre/lib/old_security/local_policy.jar < ./jre/lib/old_security/US_export_policy.jar < ./jre/lib/security/jce1_2_2.jar < ./jre/lib/security/sunjce_provider.jar
> ./jre/lib/security/cacerts > ./jre/lib/security/java.policy > ./jre/lib/security/java.security
Hmm.. Weird. After installing the new J2SDK build on the development box, the stacktrace didn't appear, but Maven quitted with an error nevertheless:
Will deploy to 1 repository(ies): R1 Deploying to repository: R1 Using private key: /home/the_user/.ssh/id_rsa Deploying: /home/the_user/tmp/OUR_PROJECT/OUR_SUBPROJECT/project.xml-->OUR_PROJECT/poms/OUR_SUBPROJECT-0.2.0-build4-SNAPSHOT.pom Failed to deploy to: R1 Reason: Error occured while deploying to remote host:repository.the.company:null
BUILD FAILED File...... /home/the_user/.maven/cache/maven-multiproject-plugin-1.3.1/plugin.jelly Element... maven:reactor Line...... 217 Column.... 9 Unable to obtain goal [multiproject:deploy-callback] -- /home/the_user/.maven/cache/maven-artifact-plugin-1.4.1/plugin.jelly:94:13: <artifact:artifact-deploy> Unable to deploy to any repositories
Then my eye fell on the sftp line in the project.properties:
maven.repo.R1=sftp://repository.the.company
Hmmm, in another project this said 'scp' instead of 'sftp'. So I reset it to scp... And beware, all was good again!
To reproduce:
I haven't tested whether it's important, but this is with OpenSSH_3.8.1p1.
More Maven findings. I've said before that in my humble opinion, Maven is too much in a state of flux to start using it in projects. I think this shows itself when you encounter older Maven projects, especially on the subject of repositories.
Maven uses repositories, where jars are kept. Those jars can be your own or someone else's. There are two types of repositories, local and remote. Local means on your own disk. Remote means ibiblio and your organization's repository. When the documentation talks about central repositories, they mostly mean remote repositories.
You'll probably want to use goal "jar:deploy" to copy your jars, wars and ears (artifacts in Maven-speak) via scp or sftp to some central box, your own organization's remote repository. Update: sftp might not work for you, see 2005-11-04
These need to be defined in your project.properties, see the Maven documentation on internal repositories:
maven.repo.list=myrepo maven.repo.myrepo=scp://repository.mycompany.com/ maven.repo.myrepo.directory=/www/repository.mycompany.com/ maven.repo.myrepo.username=${user.name} maven.repo.myrepo.privatekey=${user.home}/.ssh/id_dsa
This way, everyone can deploy using his own username. This has the following advantages:
Of course, there's a catch. You have to force everyone to have the same key name, and some users called it id_rsa or privatekey or cheese_sandwich. Maven can't figure this out itself, just like standard ssh does. We're helping it: create a file in your home directory called build.properties and add the following line to it:
maven.privatekey=/home/user/.ssh/myprivatekey
And edit the line in your project.properties to read:
maven.repo.myrepo.privatekey=${maven.privatekey}
There are also the following properties, which are deprecated and shouldn't be used. I encountered them in an older project along with the above properties and it took me a while to find out they're documented in the Maven properties documentation:
maven.repo.central=repository.mycompany.com maven.repo.central.directory=/www/repository.mycompany.com/
Note how the documentation above all the options says this stuff is deprecated, and then continues to say in the description for each option that it's deprecated and you should use deploymentAddress and deploymentDirectory in project.xml. Read on and shiver: those are deprecated as well. Deprecation upon deprecation, welcome to Maven!
Anyway, the myrepo directory should be published with an Apache or similar webserver, and the URL to reach that particular directory should be put in the remote repository properties
maven.repo.remote=http://www.ibiblio.org/maven, http://repository.mycompany.com/maven
N.B. Don't confuse all this stuff with the elements <siteAddress> and <siteDirectory> in your project.xml, these are used by the goal "site:deploy".
A colleague offered advice on setting up an Excel spreadsheet which is useful for managing features in a software development project, a.k.a. feature culling. This happens when you are planning for a new project, but you and/or management has to decide what goes in and what doesn't. Open the template and put all features in the feature column. Then play with inclusion of features for each version by entering or deleting the 1. You can immediately see the effect the feature has on the development time.
Here is the template: feature culling.xls
Joel Spolsky offers more insight into planning, with a few helpful Excel tips:
Because of my recent wrestle with Maven, a friend pointed me to this entry in the Bileblog.
Hilarious quote:
First problem, I see maven crud splattered all over. My heart sinks as I see the 3 tongued kisses of death; maven.xml, project.xml, and project.properties. This cannot possibly go well.
I'm currently wrestling with Maven and I have several gripes.
I'm using version 1.0.2. Before complaining that I should upgrade: the 1.0.2 version is considered stable, so is considered by the Maven team as suitable for a production environment.
On to my gripes:
Be careful with multiproject, too:
<dependency> <groupId>UberProject</groupId> <artifactId>UPNet</artifactId> <type>jar</type> <version>${pom.currentVersion}</version> <properties/> </dependency>
I've got most of it figured out, but I've wasted so much time that I could've written three complete Ant scripts by hand. So, it takes around three projects to get an increase in productivity by using Maven. In conclusion, I would advise other developers to stick with Ant and wait for this mess to be cleared up.
Oh and if you have to upgrade a plugin because it has a bug, take the following steps to avoid this message:
WARNING: Plugin 'maven-site-plugin' is already loaded from maven-site-plugin-1.6.1; attempting to load maven-site-plugin-1.5.2
We had to upgrade maven-site-plugin from 1.5.4 to 1.6.1 and I renamed the 1.5.4 jar to maven-site-plugin-1.5.4.jar.bak -- however by some crazy mechanism Maven downloads the old plugin into your cache again.
There's a problem with Eclipse which isn't likely to show up except when you use CVS and Maven its Eclipse plugin.
Suppose you have a bunch of empty directories and when you check out with Eclipse, you filter them:
Also, you have a directory structure like this:
myproject \--- src |--- main | |--- java | \--- resources \--- test |--- java \--- resources
You run maven eclipse to generate your classpath, which will now include main/java and main/resources. In main/resources, a bunch of properties files reside. You want to be able to see them. But you can't. Why not? Eclipse decided it's an empty package. Which it is....
What's conceptually wrong here is that Eclipse doesn't have a classpath setting, only a source path setting (configurable via menu Project, Properties, category Java Build Path, first tab Source). But it's not a source path, it's part of the classpath!
Messing with SOAP? Using Axis? Need to debug it?
I assume you have a client and a server and want to see the exact output? Don't go through the mess of configuring the SOAPMonitor, this doesn't show you the exact in/output, which obviously is a problem. Instead use plain and trusted standard Unix tools.
To view client output:
To view server output:
You could also use a traffic dump, but this is easier to read.
A personal note: you have all probably heard or seen short newsblurbs on the heavy rain in India on the radio or TV. However, lots of us in the IT industry have friends and colleagues there. So in addition to the somewhat limited media coverage I'd like to point out some extra news sources to get a more complete picture. If you're on a tight schedule, use the first link to get a visual impression.
Finally, a friend in the area reported that Bangalore and Hyderabad (where the brunt of the IT industry is located) are fine currently.
I'm ending with a tip: if you want to keep track of a certain area, go to the Times of India, and click 'Cities' in the left navigation bar.
And yet another Oddmuse module. This one provides an RSS syndication for those people who have Oddmuse installed, but can't or won't install the necessary Perl module XML::RSS. A sign of this missing module is that adding the RSS feed to an RSS reader will result in an error. Also, right-clicking and saving the RSS link will result in an empty file.
To install:
To test, add the link to the RSS feed to your favorite reader.
I've created another little Oddmuse module to display a Google Free Search or Adsense Search box on an Oddmuse wiki. I called this one google search.pl. The previous module, adsense.pl, displayed AdSense banners above pages.
Instead of (or in addition to) the usual search box, a Google search box can be put below every page. When an administrator is logged in and enters the Administration page, the normal Search & Replace boxes are shown.
To use this module on your Oddmuse wiki, take the following steps:
If you want to have the normal Oddmuse search box shown, edit the module and set the variable $showOddmuseSearch to 1.
(English readers: this is a comparison between Dutch and US hosting companies offering Virtual Private Servers)
Ik heb een overzicht gemaakt van goedkope aanbieders van Linux VPSen (Virtual Private Servers). Ideaal voor techneuten die nu een eigen website hebben maar toch meer mogelijkheden zoeken, of voor webmasters met system administration ervaring. Er is een selectie gemaakt onder de vijftien euro.
Adding search engines to Firefox is so easy that it's embarrassing. As noted before, I'm using Atlassian's Jira at work to track issues in the software and being able to search through them straight from the browser is pretty useful. To be able to do this yourself, create a file called jira.src in your firefox searchplugins directory with the following contents:
<search name="Jira" description="Jira Search" method="GET" action="http://yourbox:port/secure/QuickSearch.jspa" queryEncoding="utf-8" queryCharset="utf-8" > <input name="searchString" user> </search>
To adapt the file to your situation:
To quickly search using the keyboard:
If you put the Jira logo in the searchplugins directory, that'll be shown instead of the spyglass when picking your new Jira search plugin.
I've created a five-line Oddmuse module to display Google Adsense. I called her adsense.pl.
All it does is placing a piece of Javascript on the top of each page when the user is browsing (but not when editing a page, when using the administration screens et cetera).
To use, take the following steps:
There is a TODO list for this module, some of which I've already implemented.
Today, Slashdot linked to a slightly negative Forrester report on aspect-oriented programming (AOP). It was compared with the GOTO statement and other features that were deemed ugly. I haven't formed a firm opinion yet on AOP, but I do know that there are lots of things that are awkwardly expressed in an OO language such as Java. If AOP can make one more productive, then I'm inclined to just salute the effort.
True visionaries take a broader view: Jim Coplien wrote an article in 2001 on
symmetry and broken symmetry in programming languages. And in 2004, Victoria Livschitz gave her opinion on what she thought the next move in programming would be. Highly enlightening, especially in the recent AOP "debates"...
At work, we're using Atlassian's Jira. One of their people did a talk on pluggable J2EE web applications at TheServerSide Java Symposium. More information can be found at the company website on this webpage. Highly interesting!
Of course, the always entertaining BileBlog had something to say about it.
I've put an article on RFID online. I wrote this late last year but it's in the picture again with the recent concerns on RFID privacy. It covers the basics, relates this to software development and the offerings that are sold, and looks a bit into the future.
I regularly buy a new version of Codeweavers' CrossOver Office, which is a commercial version of Wine -- a package to run Windows software on Linux. All their code is open source, you basically pay for support and the fact that Wine is repackaged in a user friendly way, with an installer, help files, et cetera.
They have an online database where applications are rated for usage. Each application has one or more "advocates", who maintain the usability status for the app. I've become an "advocate" for Enterprise Architect, an excellent UML modelling package.
The short story is that EA runs pretty well on Linux. They even have a webpage dedicated to running their software using CrossOver, and gave an interview on this subject. I've had a crash once, and some widgets aren't drawn correctly, but for the rest it runs pretty well.
If you're still interested, regularly check the CrossOver Enterprise Architect compatibility database entry because I'm planning to keep it up-to-date with tips and tricks.
(Normally entries are in English, but this is applicable to Dutch users only).
Om te oefenen voor het vaarbewijs, wordt het ANWB cursusboek Klein Vaarbewijs verkocht met een CD-ROM met een oefenprogramma dat gemaakt is door Promanent. Het oefenprogramma is een Windows applicatie. Echter, dit programma lijkt in eerste instantie niet te werken onder Linux met Crossover Office, een commerciële Wine versie. Van het hele venster is alleen een rechthoek in het midden zichtbaar, net alsof je door een brievenbus naar de applicatie kijkt. Door de volgende regels toe te voegen aan de file ~/.cxoffice/dotwine/config (of waar je Crossover Office ook hebt geïnstalleerd), wordt de gehele applicatie getoond in een nieuw, apart venster. De applicatie is dan prima te gebruiken.
[AppDefaults\\winevdm.exe\\x11drv] "Desktop" = "800x600"
Alhoewel de executable eigenlijk VBEXAM03.EXE heet, dien je toch winevdm.exe te specificeren. winevdm.exe is de Wine manier om 16-bit applicaties te draaien. Het enige nadeel van deze oplossing is, dat andere 16-bit applicaties nu ook in een apart venster verschijnen, maar het is niet erg waarschijnlijk dat je meerdere van zulke applicaties hebt draaien.
I did a small presentation on the subject of internationalization (zipped powerpoint). Definitions, Unicode, the ISO-8859 alphabet soup, the Windows encodings and more are touched upon. The presentation itself is light on details, but the comments tell you more. I plan on doing a second part in the future. Stay tuned.
After I did the presentation, a collegue pointed me to a recent java.net weblog entry: changes in the Unicode support in J2SE 1.5. Worth a read, whether you're a Java programmer or not.
Today I put a small hack in the single script that's called Oddmuse, on which this site runs. It was one of my TODOs for some weeks.
[bart@room wiki]$ diff wiki.cgi wiki_old.cgi 454,456d453 < $text =~ s/\-\-\-/–/g; < $text =~ s/\-\-/—/g; < $text =~ s/\\\-/-/g; [bart@room wiki]$
A hyphen with a backslash in front of it becomes a hyphen. Two hyphens dashes become an em-dash. Three hyphens become an en-dash. All as per this article. And the best thing is, this was all done in under 15 minutes, including skimming the article and adding this weblog entry.
There are loads of typograhical things bothering me, one of them being the em- and en-dash--this is now fixed, however other things like curly quotes, ellipsis and ligatures are still missing. I'd like a nice fi and an ij, for starters. And I can't do it the way it's done above, you only want them outputted, not have your input changed.
Note that this stuff has all long been fixed using TeX and related and still we have to miss it on the Web and "professional" word processing packages which have reached version "XP" or "2.0" and still look not-so-good.
When you have the time, look around at C2. It's one of the oldest wikis around. A vast collection of interesting stuff; for instance, the other day I looked around for implementations of access control lists (ACLs) and voilà, c2 delivers.
One of the people behind this wiki is Ward Cunningham. At Artima, Bill Venners did an interview with Ward Cunningham.
Chet Haase blogs about how they are looking for Java applications which they want to improve on either the UI or the performance side:
http://weblogs.java.net/blog/chet/archive/2005/03/jdg_seeks_bad_c.html
It's Sun, so they probably don't want SWT applications, which leaves off Azureus. However, there must be other apps out there and I for one am going to look around. The deadline is March 31st.
You can also do this yourself, of course. Personally, I'm not very interested in the UI side, but more on the performance side. I'd say if you haven't ever used a profiler, pick an application which you think needs some performance improvement, download a profiler and run it on your application. One profiler I could recommend is JProfiler. It has a 14 day trial, but that's no problem since it passed my 15_minute_test with flying colors. I've also seen people put the built-in profiler of Eclipse put to good use.
Outside work I received a question: "We need a WebDav implementation which is complete, has admin screens and is also reachable with FTP". Two solutions were found: heavily hacked Apache and Oracle IFS. The problem with the former is that you, well, need to hack. The problem is that for the latter, one would need an experienced DBA who can administer the midtier.
Then there's an additional thing that needs attention. If you want to customize IFS, you'll need to look into its API, the CM SDK (Content Management Software Development Kit). That API is basically split into two parts: one part for the quick-and-easy tasks of copying, deleting, moving, etc. and a second part which goes deeper and with which you can really modify the workings of IFS. It makes the API really baroque, but also really powerful. I've used the CM SDK, but only for quite simple tasks; reading, writing and deleting files and folders. Looking at the baroque API, a thing occurred to me: who'd need more? It's a filesystem in the database. You can completely modify it. Great, but you probably do not need this.
However, while you don't necessarily need the baroque part of the interface, it's there as well as its more simple counterpart. And besides that, the whole product is pretty unique. I don't know any other offering which has so many interfaces to file sharing mechanisms (FTP, WebDAV, NFS, SMB/CIFS, et cetera) and is combineable with your database-driven applications.
As with many things, there are both advantages and disadvantages and before choosing, it's a good thing to be knowledgeable on both.
As an addition to the previous post, I'd like to add that issuetracking is of course just one facet of a whole project. Now, I'm not yet an expert on this, but Asa of Mozilla fame definitely is. Check this weblog entry for a highly interesting post on the subject: http://weblogs.mozillazine.org/asa/archives/007309.html
Looking back, I miss a lot of things that should've been in the curriculum of my education. I've said something about reading source code, but what most computer science students also miss, is a feeling for the difficulty of managing software engineering of big projects. In my opinion, every student should have a look at the issue system of a big project. I had some irritations in using OpenOffice and decided to see what the problem was with the bug I was experiencing. Take a look at Tracking Issues.