Gentoo Prefix as an alternative to MacPorts, Fink

I don't think many people are aware of it, but Gentoo Prefix is a valid alternative to MacPorts and Fink for installing unix-y type software on Mac OS X.

Personally, I just use it to install all those command line tools and utilities I miss from Linux.

Here's my development-centric laundry list of things I've used it to install:

  • version control
    • cvs
    • darcs
    • git
  • Java stuff (yep, it supports Java using Apple's SDK)
    • ant
    • maven
  • Others
    • nmap
    • keychain

So remember kiddies, Gentoo works on Mac OS X too!

February 21, 2008 at 03:52 Permalink Edit Destroy

NFJS: Thoughts on "OSGi: A Well Kept Secret"

The next talk I attended was "OSGi: A Well Kept Secret" by Venkat Subramaniam.

I admit, I don't have first hand experience with OSGi. The closest thing would be that my IDE of choice, Eclipse, makes heavy use of it.

At the heart of it, OSGi is an means for managing modules, and their dependencies. What's a module, you ask? It's a just a jar. Yep, just a jar with a little metadata about itself, such as what modules it depends on.

So one way to think of OSGi is that it is a way to escape from classloader hell that some people fall into.

The most concrete example I can think of for this is Spring and Hibernate. Both use asm. Different versions. That aren't API compatible. So, depending on the whim of the classloader, one version may get loaded over the other, and if your unlucky, you'll get some fun runtime errors.

If these packages had been using OSGi, it would be a non-issue. It goes to great length to isolate modules from each other, and to ensure that a module will get class dependencies from the right module dependency.

At some point, one has to think... why wasn't this part of Java from the start?

September 23, 2007 at 18:01 Permalink Edit Destroy

NFJS: Thoughts on "JavaServer Faces: A Whirlwind Tour"

The first presentation I attended was "JavaServer Faces: A Whirlwind Tour" by David Geary.

Like almost every Java web developer out there, I was working with Struts at one point. It was a dark age for me (and still is for a lot of people!).

I since moved on to use WebWork, and now Stripes. If there's anything that you can give Struts for, is it really brought the MVC pattern to the forefront. Some might say it demonstrated how not to do a MVC ;).

So what about JSF?

  • A web framework, like Struts
  • Server-side components, like Swing
  • A 'standardized' framework, ie included as part of JEE 5.0
  • JSP-based (although, this was highly contended in the expert group, and basically forced by Sun)
  • Low learning curve for Struts developers
  • Several key contributors to Struts eventually found their way to working on JSF

I'm trying to think when my first contact with JSF was, and I think it was near a year and a half ago. We were looking to switch web frameworks, and were considering Tapestry and JSF. We ultimately ended up with Tapestry. The fleeting impressions I still have is that JSF seemed overrought, and looked unwieldly to use unless you were using tools to support it (ie an IDE). At the time, the tools didn't seem like they were there, which was part of the deciding factor.

So what do I think about JSF now? Well, I might be inclined to at least give a chance.

September 23, 2007 at 16:48 Permalink Edit Destroy

Aspect Oriented Programming: Links for 2007-10-19

After attending a few sessions that talked about aspect oriented programming at NFJS this past weekend, I've been itching for a place to use it in our project. We're going to need to do some domain-level auditing at some point, so this seems like an appropriate place to do it.

Here's some AOP (more specifically AspectJ) resources for you:

September 19, 2007 at 11:31 Permalink Edit Destroy

NFJS: Summary and thoughts on the New England Software Symposium

Today marked the concussion of No Fluff, Just Stuff for the Boston Fall 2007 event. To put it simply: it was a truly amazing experience.

If you aren't familiar with NFJS, it was started just over six years ago by Jay Zimmerman out in Denver, Colorado. After many discussions with members of the Boulder Java User's Group, it was decided that there weren't any local conferences that focused on Java and agility, and that were strictly technical. Shortly thereafter, NFJS was born with a three-day symposium format. It was decided to cap the attendance at 250 in order to keep a high level of interaction between speakers and attendees. Each day has five concurrent tracks with a total of eleven 90 minute sessions with top-notch speakers from around the country.

I had the opportunity to speak briefly with Jay, and one thing I had asked was if much had changed over the past years. Apparently it had not. The particular format of the symposium works amazing well, with the small number of attendees, great speakers, and a high level of interactivity. Changing any of these would detract from what makes it so good, and would violate the original intent in which the event was started. Sure venues change, more schwagg is introduced, and technology continues to plow ahead, but at the heart, it's really the same as it has ever been, and that's a good thing.

The Sessions

There were a lot of great talks this year. Here is a list of sessions I had the opportunity to hit up:

  • Friday
    • JavaServer Faces: A Whirlwind Tour by David Geary
    • OSGi: A Well Kept Secret by Venkat Subramaniam
    • 10 Ways to Improve Your Code by Neal Ford
    • Keynote: No, I Won't Tell You Which Web Framework to Use, or The Truth (with Jokes)
  • Saturday
    • Productive Programmer: Acceleration, Focus, and Indirection by Neal Ford
    • Productive Programmer: Automation and Canonicality by Neal Ford
    • The Busy Java Developer's Guide to ClassLoaders by Ted Neward
    • Leveraging Annotations with AOP by Ramnivas Laddad
    • Birds of a Feather: Dynamic Languages with Neal Ford
  • Sunday
    • Software Development Risk Analysis Techniques by Mark Johnson
    • Adding Behavior to Java Annotations by John Heintz
    • Experts Panel with all speakers present
    • REST: The Basics and Not So Basic... by John Heintz
    • Refactoring Ant Builds with Ivy, Groovy, and Good Old Fashion Common Sense by Andrew Glover

If I can find public copies of any of these presentations, I'll update this list with links.

Some future posts...

I found a few of the talks to be particularly fascinating, so I hope to follow up with several posts:

  • Productive Programmer
  • ClassLoaders
  • Annotations + AOP + Behavior
  • A summary of tips, resources, etc from everything

If you don't see something about these in the next week or so, feel free to hassle me a little :)

Pseudo random thoughts, observations, and feelings

  • Things were pretty swagtastic this year
    • A pleather binder that zips close, came in extremely useful
    • A nice backpack, but I won't likely use it...
    • A CD with all the presentations
  • The venue was the Framingham Sheraton
    • Great food
    • Great service and staff
    • Maybe a little overzealous on the AC in a few rooms
  • Being around smart and passionate people definitely rubs off
  • Definitely feeling
  • Each day felt much longer than it was, in a good way
    • Amazing amount of new material
    • Constantly experiencing paradigm shifts
  • All the speakers I spoke with were very approachable
  • A lot of people didn't seem quite as engaged, as much as I was at least
    • Sitting leaning back during talks
    • Not taking notes
    • Not asking questions, or talking to the speaker afterwards
    • Not engaging in conversation with other attendees between sessions or at meals
  • Survey says...
    • Most people are on Java 1.5 now
    • Most of the people still on Java 1.4 are there because of WebSphere
    • WebSphere sucks
    • A majority of people are doing automated testing
    • More people are doing continuous integration
    • More people are using not struts, including JSF, Tapestry, and Spring MVC
    • Most people are pretty psyched about Groovy, JRuby, and Grails
    • Overwhelming majority of people are using Eclipse
    • Most of the speakers are now Mac users
    • Most of the speakers are using IntelliJ IDEA

Advice for potential attendees

The most significant piece of advice I can give is this: be engaged. You have an amazing opportunity to interact with experts in the fields. You are surrounded by feels geeks and hackers who take time off to go to these kinds of things. Talk to them! Take notes! Absorb!

Wrap it up, B

I really can enumerate enough how awesome of an experience it was. I'm feeling pretty pumped up to get back to development to put this new knowledge to use. If NFJS is coming to a city near you, take the plunge; you won't regret it.

September 17, 2007 at 00:22 Permalink Edit Destroy

Java: Tons Standardized APIs, but not so many standardized practices

Java has more standardized APIs than you can shake a stick at. Servlets, JSP, EJB, JPA, and the number is always growing as people put together new JSRs. There's even more defacto standards, like Spring, Ant, Maven, etc.

What you don't see is standardized practices for common things you have to do when you maintain an application. I'm not talking about code here. I'm talking about things like getting a development environment going, or maintenance of configuration and database schema, or deploying applications to staging areas or production.

Time and time again, it seems like different companies / developers / etc roll their own ad hoc solutions to these problems.

I'll illustrate with the example of building a developer environment.

Developer environment

Setting up developer environments typically sucks. Does this sound familar?

  • Download a JDK, install it somewhere
  • Download Tomcat, extract it somewhere else
  • Download Eclipse, extract it somewhere random
  • Download Ant, extract it somewhere completely different
  • Hack together a .bash_profile, and update the PATH to point at all these random paths you've put together

If you are lucky, there might be scripts to automate this, or maybe a tarball with everything you need and the appropriate shell files to get a sane shell environment.

If you are even luckier, you are running Java on Gentoo, and can just do 'emerge www-servers/tomcat dev-util/eclipse-sdk dev-java/ant'.

How can we right this wrong?

So what made building a dev environment less sucky? Tools.

In the first scenario, there were none. You were left to manually do everything yourself. Need to upgrade something? Have fun figuring out where you should drop the files and ensuring that your shell scripts are pointing at the right locations. Accidentally threw your machine out the window and have to build a new one from scratch? Good luck remembering all the intricacate steps you took to get to your last good state. The result: Pain to reproduce, and annoying to maintain.

In the next scenario, you do have some tools for getting things an initial environment going. But there probably aren't tools for making sure you're up to date. So while you can reproduce environments readily enough, you can't necessarily maintain them easily over time, and now you have the additional burden of maintaining these tools.

In the last scenario, we're entirely leveraging tools that are already out there. But what if it doesn't quite fit your needs? Well, it's all open source, so you have all the access you need to improve things. And for bonus points, you can improve things in a general enough way so that you can send your improvements back upstream so that everyone using the tools can benefit.

So what exactly are the tools doing here?

  • Making your life easier
  • Creating de facto standards

Summary

Build a better future through superior tools. Yeah, I like the ring of that.

August 29, 2007 at 17:34 Permalink Edit Destroy

An Experiment: Links for 08-03-2007

I've decided to try a daily (or near daily) roundup of links I've come across. The intent, for now, is to fill in gaps between days when I don't get to write up a real post.

  • Recapping UI Architectural Patterns Model View Controller is a common pattern you see in Java web frameworks. Less common is Model View Presenter, although I hear it is used in the C# world. It's an informative read to compare the two, as well as some derivatives thereof.
  • Opportunity Overload These past few months, I've found myself reading a lot more blogs outside of my typical technical fare. Finances, 'life hacking', productivity, and so on. This post struck a chord with me, and it has me re-evaluating what I'm trying to achieve by being informed on these topics.
  • Why Ruby On Rails Succeeded Rails really seems to be picking up steam nowadays. I have found myself particularly enamored with it. This post is a nice retrospective about how it got to where it is.

This format, of course, is experimental. Feel free to leave feedback on the good and the bad.

August 03, 2007 at 10:51 Permalink Edit Destroy

Our evaluation of Selenium for web testing

Like the good little code monkeys we are, it is time for us to adopt some form of web testing. There is only so much unit and integration testing can help you, before you need a fuller solution.

Given its maturity, Selenium seemed like the obvious choice. Here's what I found:

The Good

Here's some things we liked:

  • An IDE, as a Firefox Extension, for building unit tests
  • Support for testing in a many languages, such as Java, Ruby, their own Selenese (basically glorified HTML)
  • The IDE generates Selenese, which can easily be converted to one of the above mentioned languages
  • Support for running in multiple browsers across multiple platforms
  • Support for running selenese tests using ant

All in all, pretty cool stuff.

The Bad

However, when we went down to our particulars for our project, things fell a little short. As a brief background, we use ant for building, junit for testing, and bamboo for continuous testing.

You can convert from Selenese to your language choice, but once you do, you can't go back. This is kind of expected, as you can do all sorts of trickery to the code after converting it from Selenese. The API for interacting with Selenium closely follows the Selenese. Here's an example of Selenese, and then converted Java.

<tr>
   <td>open</td>
   <td>/</td>
   <td></td>
</tr>
<tr>
   <td>clickAndWait</td>
   <td>link=diabetic nephropathy, schizophrenia, and bipolar disorder</td>
   <td></td>
</tr>
<tr>
   <td>clickAndWait</td>
   <td>link=Steering Committee</td>
   <td></td>
</tr> 

public class NewTest extends SeleneseTestCase {
   public void testNew() throws Exception {
       selenium.open("/");
       selenium.click("link=diabetic nephropathy, schizophrenia, and bipolar disorder");
       selenium.waitForPageToLoad("30000");
       selenium.click("link=Steering Committee");
       selenium.waitForPageToLoad("30000");
   }
}

The code here produced isn't the cleanest, because the API is closely following Selenium conventions, rather than using the language's conventions. For example, Maps should be used, instead of something like "link=Steering Committee", and Integers should be used instead of number in a String.

Because you can't go back to Selenese from code, we decided we should always work with Selenese, so we can maintain tests easily using the IDE. This means we need to use the 'selenese' ant tasks for running our tests.

This is how our invokation looks:

<selenese suite="${dir.webtest}/selenium_test_suite.html" 
  results="${dir.selenium}/selenium_test_results.html"
  browser="*firefox"
  timeoutInSeconds="90"
  startURL="${webapp.url}/" />

The first issue is that you have to specify a test suite. You can't just give it a directory, or fileset, that includes all your tests. This is one extra thing to maintain, and it becomes easy to forget to add new tests to it.

The other issue is the output. It's just an HTML. We want to be able to generate junit-like XML, so a report can be generated along with all our other tests.

Coming to terms

Since this is open source, the obvious solution is to get hacking, and so I started delving into the source tree.

I had two primary impressions of the codebase. The first is that there aren't suitable layers of abstraction. For example, instead of having a class representing a suite of tests, and a class for representing tests, java.io.File instances get passed around and grokked as their needed. Second was that it isn't sufficiently extensible for. There weren't any places we could hook in, or classes to extend, to change the results ouput, or even get at it.

On-the-fly suites

The issue here is that the code is expecting a File to be passed in, which contains all the tests. I had hoped it had some abstraction which would parse through the suite, so if you wanted, you could programattically build up a suite.

So here, we can get around this by building up a temporary File, which contains the appropriate HTML for Selenium to understand it as a suite.

JUnit reports

When looking at the code, I had hoped to see like a TestResult class, that you could get the results out of, and then have a way for outputting the results as you see fit.

Since we can't do that, the next best thing would be to parse through the results' HTML, and spit out XML laid out in a way that JUnit's reporting mechanism would be able to understand.

Success!

After a day or two of hacking around, I was able to implement the workarounds I mentioned here.

Unfortunately, the implementations turned out to be a bit too closely tied our environment, so I can't readily turn it out to the rest of the world.

Hopefully, I will have the time to do the necessary refactorings to be able to do so.

August 01, 2007 at 16:05 Permalink Edit Destroy

Of Dreams unfulfilled, JMock, and Expectations

I just had an observation about the pattern of setting up expectations of our jmock tests. So here's a typical code block for setting it up:

final List<UserGroup> groups = this.groups;
final List<User> users = this.users;
final User user = users.get(0);

final UserService userService = this.userService;
this.jmockCtx.checking(new Expectations()
{{
  // first, rehydrate
  allowing(userService).findAllGroups();
  will(returnValue(groups));
  allowing(userService).findAllUsers();
  will(returnValue(users));
  will(returnValue(true));
  // now, save
  one(userService).createUser(user);
  one(userService).findAllUsers();
  will(returnValue(users));
}});

I was thinking, hey, why not just use this.groups, this.users, etc, directly in the expectations, instead of making new references to them? It might look like:

this.jmockCtx.checking(new Expectations()
{{
  // first, rehydrate
  allowing(this.userService).findAllGroups();
  ...
}});

This ends up being an error because 'userService' cannot be resolved or is not a field. Unexpected behavior, right? Almost.

A little background about what this code chunk is actually doing: when we do new Expectations() {}, we're actually creating an anonymous subclass. At that point, 'this' would refer to the Expecations subclass, not the test we're in.

When we do the second set of {}s, we're adding an initializer block. The best way of thinking about this is that basically, it gets invoked when you instantiate an instance of an object, similar, but different to the normal contstructor. You may be more familiar with static initializer blocks, doing something like:

public class Something {
  private static Map map = new HashMap();
  static {
    map.put("key","value");
  }
  ...
}

So my dream of using this.users and pals in my Expecations, can only be that, a dream.

July 24, 2007 at 15:22 Permalink Edit Destroy

Dealing with libraries that like breaking their APIs

I'm currently working on making use of a Groovy on a project of mine which uses Hibernate and Spring among other things.

My code wasn't particularly well tested in terms of unit tests. By this, of course, I mean there were no unit tests.

So like a good code monkey, I decided to get some unit tests going, verify they work, then move code over to use Groovy. The benefit here being that by having these tests, I can verify that things still work as expected after the migration.

I figured on trying out rMock, one of the many mocking libraries out there for Java. I get my first test case written, cross my fingers, and hit the run button (this is in Eclipse)... and what do I get, but the infamous red bar. NoClassDefFound... WTFBBQ?!? For whatever reason, it wasn't finding certain classes from dev-java/asm.

I won't go into further detail about how I found this problem, and found the cause, but here are my findings (versions here refer to slots):

  • dev-java/groovy uses dev-java/asm-2.2
  • dev-java/hibernate uses dev-java/cglib-2.1
  • dev-java/rmock uses dev-java/cglib-2.1
  • dev-java/cglib-2.1 uses dev-java/asm-1.5

The issue here is that asm apparently changed it's API quite a bit between 1.x and 2.x. This problem seems to have cropped up a few times at least according to google (search for 'NoClassDefFoundError: org/objectweb/asm/CodeVisitor').

The asm tutorial even goes so far as to the changes... kind of. See here under the "Changes in the ASM 2.0 API Since ASM 1.x" section. A few things bother me about this.

  • I don't see why the major changes, like renamed classes, and changed method signatures, couldn't have been deprecated at first, and do some twiddling to proxy calls to deprecated things to the newer ones.
  • The line that goes like "In general, it would be a good idea to run tool like JDiff and review the differences between the ASM 1.x and 2.0 APIs." Maybe it's just me, but this seems a bit presumptious. I mean, while such a tool is probably useful, it is far from thorough. It might point out where the API changed, but would have no clue as to the significance of those changes, or how you would account for them.

A question that might come out is why would rmock expose this problem, when hibernate is using the same version of asm? Presumably it is because hibernate isn't exercising the parts of the cglib API that use the offending parts of asm, so I must have lucked out before now.

Regretfully, this seems somewhat common in the Java world. Maybe not very common, or even common, but common enough that they stick out in my mind, causing a handful of angst and frustration.

There is some good news though. cglib-2.2_beta1 seems to have been updated to use the asm-2.x's API. Another bit of fortune is that it's unlikely that anything in the tree will run into this particular snaggle, just code monkeys like me using these various libraries.

For the record, I don't get the ClassDefNotFound anymore, but instead I get a lovely NullPointerException from down in Groovy. Oh well, one step forward, one step back.

January 14, 2007 at 02:41 Permalink Edit Destroy

Java gets Groovier

This news is a bit belated by a few days but.... over the weekend, I spent some time getting the recently released Groovy 1.0 into the tree.

In case you hadn't heard about it, Groovy is, among other things, a dynamic language that runs on the the Java VM. Some interesting data points about it:

  • It's dynamic, for reals.
  • It's about 98% syntax compatible with Java code (I made that number up, but really, it's pretty durn close).
  • Java bytecode gets generated at runtime, no need to compile.
  • Groovy can generate Java bytecode to your typical .class files

A consequence of these points is that you can easily migrate from Java to Groovy, and have your project running exactly as it was. Then slowly, you can get into the swing of things, and take advantage of everything that Groovy has to offer as you get the hang of it.

One fear I've noticed of Java developers of jumping into a more dynamic language like python or ruby is late binding. You can't really be sure the type of your objects until runtime. Sure, you can read the documentation (assuming it's up to date) or peek at the code to be sure. With Java, binding occurs at compile time, so you can be sure that foo method expects a Bar, or that Bar has the aieeeee() method. I suspect some of this comes from defensive coding, where you become concerned about how your code will be (ab)used by others.

To combat this, a coworker and I have this idea... You use Java to define interfaces for the, uh, interfaces you care about. You can then use Groovy to implement these interfaces. By doing this, you get the best of both worlds: clients of your code get their strongly typed interface, and you get to do implementations with a more expressive syntax.

Overall, I've been pretty impressed with Groovy so far. Granted, I haven't used it as deeply as possible yet, but it certainly has a lot of potential.

In case any of this sounds interesting, here's some resources:

And in other Java dynamicism news, I've added the freshly minted JRuby 0.9.2 to the tree this past weekend as well. I haven't played with it yet, so I can't speak much on its behalf other than it's an implementation of Ruby written on the Java VM. Perhaps that can be the topic for a future blog post.

January 11, 2007 at 02:40 Permalink Edit Destroy

Musings of the current state of open source Java

[Note: I'm actually referring to open source Java software and libraries, not Java itself]

I've been maintaining and working with Java packages for pretty close to a year and a half now. And I hate to say it, but it is only becoming more apparent that things are less than ideal.

Sure, there are a multitude of projects out there, great projects. Eclipse, Tomcat, Netbeans, Azureus, all of the Apache Jakarta project, and many more. For a developer, it's great.

For a packager... it's not so nice of a picture. Builds packages vary from project to project with some kind of unholy glow. While there are some defactor standards out ther e, ie using ant or maven, it ain't pretty.

How do you build your javadocs? Is the target named doc, docs, javadocs, javadoc, or api?
How do you manage your dependencies on third party libraries? Include every jar under the sun, bundle the source in with your own, or download the from the interweb?

The latter of these is particularly irksome. As I said, the standard practice is generally to include all your dependencies. I recall reading an O'Reilly book on ant at some point, and they actually encourage this behavior. I seem to think they said something along the lines of "You can't trust your user to use the right dependencies, so you should include them so that things will definitely work."

I'm fairly sure most of this be traced back to influences of the Windows world. I mean, there really isn't a concept of dependencies on other packages. You just distribute your application in a giant blob, and be done with it.

While I'm sure it's convenient if your developing the application or distributing a single blob to a user, it certainly is a pain to package.

So for all the dependencies, we want to package the dependencies, and then package the dependencies' dependencies, and so on. Then we want to make the application use our copy of the dependency that we just packaged. Easy enough, right?

Not quite. Here are a few of the many problems we come up against all too regularly:

  1. The API of the dependencies are unstable, as in, they break between minor revisions.
  2. The dependency has been patched in fun and exciting ways that are specific to the application.
  3. The origin of the dependency is unknown, and no upstream can be found.

Quite dreary, eh?

Fortunately, it is not always this bad. There are, of course, good applications and libraries which are sane enough to package. Maven, in some senses, has been helping improve things, by standardizing the way things are being built, and by providing a standard mechanism for getting dependencies. A step in the right direction, at the very least.

Stay tuned next time for some ideas for addressing these concerns...

October 20, 2006 at 02:37 Permalink Edit Destroy

Java she wanted, Java she got

It is with great pride that I am able to announce the 'new' Java system is now stable on all archs where we support Java! That means amd64, ia64, ppc, ppc64, and x86.

In case you've been stuck in a cave somewhere, and hadn't heard anything about the new system, here are some features highlights:

  • Changes to user and system VM happens instantly. No more need to run env-update && source /etc/profile!
  • One-time changes to the VM by using GENTOO_VM, ie GENTOO_VM=kaffe ant would run ant using kaffe, instead of the user or system VM
  • Packages no longer depend on the system VM being set properly. This means that an appropriate VM will be used for building for packages. A package needs 1.5 or later? No sweat! Only builds with 1.4? You got it!
  • Now you can use all the Java 1.5 goodness you want with impunity!
  • We'll be able to support Java 1.6 when it comes out in Decemeber in a much more reasonable amount of time.
  • Support for configuring your Java browser plugin using eselect.
  • Support for configuring your VM using eselect.

While this may seem like a small list, it is a significant improvement over the old way of things. And this list is of user-facing changes... there are also vast improvements which help a lot of the developer side of things (ie making things much more maintainable).

[edit]
On a side note, if you have been using the new system for a while, there are a few things you may want to do:

  • Make sure you're not using the old migration-overlay. This will cause some problems if you try to emerge VMs among other things.
  • Remove the package.mask entries if you had used them
  • Remove the package.keywords entries if you had used them

In other news... I've been always been a bit quiet on the blogging... but, I hope to change that, at least a little bit. I have some ideas for some writeups to show off Gentoo as a Java development platform... so stay tuned :D

October 19, 2006 at 02:36 Permalink Edit Destroy

Summary of Java team meeting

Cross posted to gentoo-dev and gentoo-java mailing list.

Yesterday, the Java team held a meeting. The agenda for the meeting is available at here. This summary follows the format of the agenda.

  1. Personel updates

    First task was to aquire information about active developers who work with Java related ebuilds, it produced following list:

    • betelgeuse (Petteri Räty)

    • caster (Vlastimil Babka)
    • gurligebis (Bjarke Istrup Pedersen)
    • nelchael (Krzysiek Pawlik)
    • nichoj (Joshua Nichols)
    • sanchan (Sandro Bonazzola)
    • wltjr (William Thomson)

    More details about areas of responsibility are available in meeting notes.

    Missing developers:

    • compnerd (Saleem Abdulrasool)
    • karltk (Karl Trygve Kalleberg)
    • zx (Chris Aniszczyk)

    Second task was to establish a list of developers along with architectures with which they can work:

    • alpha - no support for Java
    • amd64 - nichoj, sanchan
    • arm - no support for Java
    • hppa - no support for Java
    • ia64 - nichoj
    • m68k - no support for Java
    • mips - no support for Java
    • ppc - nelchael, nichoj
    • ppc-macos - no support for Java
    • ppc64 - nichoj
    • s390 - no support for Java
    • sh - no support for Java
    • sparc - no support for Java
    • x86 - all Java team developers
    • x86-fbsd - gurligebis

    It was decided to drop support for dev-java/compaq-jdk and dev-java/compaq-jre on alpha - those two packages don't work as expected and are not supported by upstream. Sparc and alpha wait for fully working free Java JDK/JRE (kaffe, gcj and gnu-classpath for example).

  2. Migration to the new Java system

    It was decided that no new features will be added to 'core' Java packages to allow proper testing and bug fixing. We are targeting 14 October for stabilizing core packages, list of core packages is available at Java Upgrade Guide under "Code Listing 2.1: package.keywords". There was also talk about what features are planned to make their way into java-config before feature freeze, for example --tools option to get location for tools.jar from currently selected VM.

    Current status of migration (list of not migrated ebuilds, progress graph) is available at status page along with 'current' state at not-migrated-current.

  3. Feature requests

    Only one point made it's way into "Feature requests": virtuals for several Java packages: javamail, jaf and others. To better understand the problem lets take a look at packages that could provide virtual/javamail:

    • dev-java/sun-javamail-bin

    • dev-java/gnu-javamail
    • dev-java/sun-javamail (currently in Java overlay)

    Same situation is with JAF (JavaBeans Activation Framework). Decision about virtuals was postponed as minor issue, since it can wait until after the new Java system is stablized.

  4. Documentation

    It was decided that the Java Upgrade Guide needs to be updated and it needs to list possible upgrade paths. Additionally following documents need work:


    Following documents need to be created:

    1. How to be a good downstream - document decribing best practices about handling Java
    2. Guide to using maven in ebuilds - this document is currently blocked by not complete maven ebuilds (see 'Future plans')


    We are also looking for articles that cover Java support on Gentoo.

  5. QA / static analysis tools

    Using die after eant in ebuilds has been deprecated: eant dies on it's own, so:

    eant ... || die "eant failed"

    should be changed just to:

    eant ...

    New checks for usage of old eclasses and other QA issued are pending inclusion in repoman. Additionaly pcheck will probably be implemented as repoman modules after repoman gains ability to use such modules, not as separate tool. Eclipse plugin for writing ebuilds (and performing QA checks) was started by zx, but is currently unreleased. Gentoo user benny^work was also interested in such plugin, but current state of this effort is unknown. Developer wltjr suggested making such plugin also for Netbeans. One possible way of creating such plugin (aside from implementing syntax highlighting) is to use Jython to use checks from repoman.

  6. Future plans

    One controversial step, split of dev-java into more smaller categories, was postponed for now. It will be reconsidered after stabilizing new Java build system.

    Additional third quiz will be required for new developers that want to join Java team due to specifics of Java builds. Such quiz would have few general questions about Java, handling classpath and ant builds.

    State of maven on Gentoo was given by nelchael, and is available in attached log. We are currently waiting for 2.0.5 release of maven to build it from source and allow ebuilds to use it to build other software. For now it is required to use `mvn ant:ant` to obtain build.xml file for ant, which can be used in ebuilds.

    Last two points of agenda: Java 1.6 and Java 1.7 were discussed. There was talk about how to prepare for upcoming release of Java 1.6 in October (that date is not fixed - it may change), troubles with JDBC drivers as Java 1.6 introduces new functions, which breaks compilation of current JDBC3 drivers. Testing of Java 1.7 has been postponed until 1.6 comes out.

  7. Not on agenda

    Following topics were mentioned that were not on agenda:

    • Estimated EOL (end of life) for generation 1: until all ebuilds are
      migrated to generation 2 and stabilized we have to keep generation 1 alive in
      tree

    • packages that break due to generation 2:
      • dev-java/jarjar

      • dev-libs/cyrus-sasl
      • kde-base/kdejava
      • kde-base/qtjava
      • app-accessibility/gnome-speech

      That list is probably not complete.

    • contacting David Herron (Sun employee, who helped to bring DLJ licensed Sun JDK to potage) about packaging and distribution of other Sun Java packages, for example Sun JWSDP, JAF, Javamail
September 10, 2006 at 02:35 Permalink Edit Destroy

Stale /etc/portage/package.unmask

As a recommendation to people who use /etc/portage/package.unmask regularly: You really ought to keep tabs on the thing that you're unmasking... and once it has been unmasked, you should remove the entries from package.unmask.

Here's a scenario: You heard about the new Java system being in package.mask, so you decided to try it. Cool. It has since come out of package.mask... but you still have it unmasked via /etc/portage/package.unmask. Now, we release a new revision of java-config that we put in package.mask for testing... and now you get the version that we are heavily tested, and it doesn't quite work 100%...

So, please, be mindful of your package.unmasks.

August 03, 2006 at 02:33 Permalink Edit Destroy

JAVA_HOME pointing to generation-1 system vm

So, one of the issues that has come up on occaision is that JAVA_HOME ends up pointing at, for instance, /opt/blackdown-jdk-1.4.2.03, instead of the shiny, recently unmasked Java 1.5 you installed and set as your VM of choice.

The reason for this has is legacy support. java-config-1 isn't so smart. It determines what the current VM is based on JAVA_HOME in the environment. It expects it to be living under /opt/${P}, where ${P} is the name and version of the VM.

The workaround we found is described in the upgrade guide. However, the problem is, that java-config-1 would then no longer be able to know what VM is currently being used, which is a bit problematic.

Thanks to the hax0ring skills, we now have a patched java-config-1 that uses VMHANDLE instead of JAVA_HOME. VMHANDLE is the token by which a VM is identified with the new Java system, and happens to be in the environment.

We have added a new entry for /etc/profile.d, which uses the prescribed way of setting JAVA_HOME from the upgrade guide. This means that JAVA_HOME would be set correctly most of the time. The only time it wouldn't be accurate would be if you did not have a user vm set (JAVA_HOME points at /etc/java-config-2/current-system-vm), and then you set a user vm, JAVA_HOME would point at current-system-vm, instead of ~/.gentoo/java-config-2/current-user-vm. Running 'source /etc/profile' though, remedies the problem.

Perhaps java-config-2 can be updated to give notice that you need to source /etc/profile ? Or perhaps it can directly update JAVA_HOME... The only problem with the the latter point ist hat it would probably only fix JAVA_HOME in the current terminal, and not in all the other open terminals.

I've added revision bumps of java-config to the tree that work as described here. Because of the changes though, I've put them in package.mask while we finish testing the new way of handling JAVA_HOME. The package.mask entry is below, for those interested in testing and providing feedback:

# Joshua Nichols <nichoj@gentoo.org> (02 Aug 2006)
# Testing new versions of java-config, which will let us remove
# JAVA_HOME from env, which points to generation-1 system vm
=dev-java/java-config-1.3.0-r3
=dev-java/java-config-2.0.26-r6

Assuming there aren't any issues while testing, I expect to unmask it in a day or two. At that point, I'll also update all the env.d files for the VMs, so they no longer export JAVA_HOME (note: this is different from the profile.d, which is actually overwriting the JAVA_HOME originally being set by the env.d file).

August 03, 2006 at 02:32 Permalink Edit Destroy

Java 1.4: Do we still need it?

The answer, as of this moment, is most definitely. There are two reasons for this at the moment.

  1. there are still packages which don't compile when built with Java 1.5. In these cases, the new Java build system switches to a 1.4 JDK for building.
  2. it is needed for packages that haven't been migrated to use the new Java system. This is necessary, otherwise we encounter the same exact problems that prompted the initial package.mask of Java 1.5.

Just to recap why Java 1.5 was package was package.mask'd.... It really comes down to backwards compatibility, and that Java 1.5 isn't 100% backwards compatible with Java 1.4. Things that ran with Java 1.4 should still run with Java 1.5... but some things that once built with Java 1.4 no longer compile with Java 1.5. Specifically:

  1. There's a new reserved keyword with Java 1.5, enum. So where you used to be able to use enum as a variable name, you no longer can in 1.5.
  2. A number of new methods have been introduced to some abstract classes and interfaces. If a particular implementation doesn't implement the new methods, then it won't compile against Java 1.5

Now, say you're using Java 1.5 to build all your packages, and then you come up to a package that can't compile for one of these reasons? It'd fail for one. But then you may try with Java 1.4... and all is well until you see a compile error: UnsupportedClassVersionError. What does this mean though?

Well, each major release of Java has it's own version of bytecode. Bytecode is forward compatible, ie run 1.4 bytecode in 1.5, but not backwards compatible. If you try to use 1.5 bytecode in 1.4, you will see the infernal UnsupportedClassVersionError. This happens because, since you were using Java 1.5, the dependencies of the package you were just trying to compile with 1.4 were built with 1.5, and the default behavior is to build the highest possible bytecode.

So, these are the reasons Java 1.5 was package.mask'd, and why we need to use Java 1.4 for building unmigrated packages.

But how does the new Java system help?

  • We get around the problem of enum by specifically telling the compiler to use source="1.4", where enum is a valid variable name.
  • We get around the changes in API by switching to a version where it can be compiled, until such time as the package can be properly patched.
  • Additionally, we make javac compile the lowest possible bytecode, so it can be used by as many other packages as possible.
August 01, 2006 at 02:30 Permalink Edit Destroy

Tomcat 5.5 and Eclipse 3.2

I'm pleased to announce that www-servers/tomcat-5.5 and dev-util/eclipse-sdk-3.2_rc7 have been added to portage over the long weekend.

We strongly encourage users to update to tomcat 5.5, and refrain from using earlier versions, as recommended by upstream. 5.0 and earlier will likely be removed in the future, and have put it in package.mask. Don't worry though, it won't go away right away, so users should have time to migrate.

As for eclipse, there are few few changes between 3.2_rc7 and the official 3.2 release. Once we verify our patchset works against 3.2, you can expect to see the official release added to portage. It is in package.mask for testing, and until we get the final release out.

July 04, 2006 at 02:29 Permalink Edit Destroy

Updated Java System and Java 1.5 unmasked

The Gentoo/Java Team is proud to announce the release of the updated Java system. This means that Java 1.5 is finally unmasked.

It is currently in ~arch. To begin using it, follow the upgrade guide:

http://www.gentoo.org/proj/en/java/java-upgrade.xml

Here are some highlights of the new system

* Ability to switch the current VM on the fly

  • Changes to the user and system VM take effect immediately, and no longer are tied to the shell environment, which means you no longer have to run env-update followed by source /etc/profile when you switch the system VM
  • Now has the concept of a "build VM", which is used to emerge packages, and is configured independently of the system VM
  • For each version of Java, ie 1.3, 1.4, 1.5, etc, the build VM can be configured as to which vendor and version of a VM to use
  • The VM at emerge time will be switched on the fly according to its configuration, as well as the dependency of the package. For example, some packages won't compile with 1.5. In these cases, a 1.4 VM will be used at build time
  • Java packages which build with ant will have their build.xml rewritten at build time in order to ensure that the correct version of Java bytecode is compiled
  • Java 1.5 has been unmasked, and we will be ready for Java 1.6 when it is released this fall.
  • July 01, 2006 at 02:24 Permalink Edit Destroy

    Update: The New Java Hotness

    Just to keep people updated about how the new Java stuff is going... it's going pretty good :-D

    A lot of smaller kinks have been worked out, better documentation, more useful error / warnings, and such forth. All in all, there has been a lot of good input and feedback.Most of the issues users have been running into is not having everything unmasked and keyworded properly. With unmasking,the former will no longer be an issue.

    So, I hope to go forward with unmasking over the long (read: 4 1/2 days) weekend. At that point, we'll begin switching packages over to using the new eclasses, doing version bumps, bug squashing, and all that jive.

    June 29, 2006 at 02:23 Permalink Edit Destroy

    The New Java Hotness

    I'm pleased to announce that the new Java hotness has finally hit the tree :) It's currently in package.mask, but I expect to unmask it in the next few days.

    To begin using it, you will need to add the appropriate entries to /etc/portage/package.unmask, and then follow the upgrade guide.

    For those not familar with that this means, here are some highlights:

    • Ability to switch the current VM on the fly
    • Changes to the user and system VM take effect immediately, and no longer are tied to the shell environment (ie no more running env-update && source /etc/profile after switching the sytem VM)
    • Now has the concept of a ‘build VM’, which is used to emerge packages, and is configured independently of the system VM.
    • For each version of Java, ie 1.3, 1.4, 1.5, etc, the build vm can configured as to which vendor and version of a VM to use
    • The VM at emerge time will be switched on the fly according to its configuration, as well as the dependency of the package. For example, some packages won't compile with 1.5. In these cases, a 1.4 VM will be used at build time.
    • Java packages which build with ant will have their build.xml rewritten at build time, in order to ensure that the correct version of Java bytecode is compiled.
    • We'll be able to unmask Java 1.5 soon, and be able to handle Java 1.6 when it comes out this fall.
    June 26, 2006 at 02:20 Permalink Edit Destroy

    Of Java 1.5 and Gentoo

    The road to unmasking Java 1.5 has been long and arduous. There have been enough issues to warrant it's own FAQ and an entire redesign of the way we handle Java packages.

    I won't go into detail about the specific problems incurred, as the FAQ should sufficiently cover them.

    Nearly a year ago, work was begun on a new build system (ie new eclasses and a new version of java-config). About six months later, we had a new fully featured, flexible build system. Highlights include build-time VM switching, build-time build.xml rewriting, and a more flexible means of storing/setting the system and user VM.

    Unfortunately, there were enough incompatibilities between this new system and the old one that we couldn't just drop it in the tree as is. A few months were needed to determine how to best migrate to the new system, in such a way that it could be done incrementally, and it could be properly tested (ie be in ~arch). Notes about the method we choose can be found on our wiki.

    Since then, a lot of work has been done to implement the migration system, as well as code and documentation cleanup.

    So now, we (kartlk and I), have deemed the new system ready for prime time. This coming week, we will be finishing any last minute cleanups, and bringing in any packages that require 1.5. Once that is complete, we will be announcing the changes on the developer mailing for public scrutiny/input. Assuming that there are no issues that crop up, the new system would be brought into the main tree a week or so later.

    You may begin rejoicing now.

    May 22, 2006 at 02:17 Permalink Edit Destroy

    Java ideas for Summer of Code

    As has been previously announced, we are officially part of Google's Summer of Code. I've decided to step up to be a mentor, and in particular, to mentor projects related to Java on Linux.

    A few ideas follow. The 1a and 1b are listed already on our SoC page to an extent, but the idea is elaborated further here. If you plan on proposing one of these ideas, I really would expect you to even further elaborate.

    1a)
    Summary:

    Build most of our Java packages with free (libre) virtual machines and free implementations of public APIs.

    Background:

    Currently, we really only support using a proprietary virtual machine (ie sun, blackdown, ibm, etc), because packages are likely to fail for various reason with the open ones.

    For many open apis, such as javamail, java activation framework, etc, we have binary packages of Sun's proprietary implementations. In a number of cases, there are open implementations. However, our packages compile against and run using the proprietary implementations.

    For reasons why one would want to be using Free Java, see the article on the Java trap.

    As for a practical reason, use of proprietary packages from Sun and IBM can annoying for the end user, because in both cases, it requires placing a fetch restriction on the distfiles. To the end user, this means that an emerge gets halted until they agree to a license, and download the files.

    Goals:

    • Build/run all/most packages using free virtual machines
    • Build/run all/most packages against free implementations of public APIs
    • Might want to target specific big name packages, like eclipse, azureus, tomcat.
    • Be able to select between different implementations of the same apis

    Tasks:

    • Work with upstream of packages that use propertary classes from the virtual machine (ie com.sun.*, sun.*)
    • Work with upstream of virtual machines and packages when packages don't compile or run with using free java
    • Find and package open implementations of public APIs

    Hurdles:

    • Lots of Java packages (300+). It is unknown how many will need to be patched.
    • Upstream might not care about free java
    • Might not be open implementations of all APIs

    1b)

    Summary:
    Native compiling with gcj

    Background:

    GNU Compiler for Java (gcj) allows for compiling Java code to native machine code, as opposed to Java bytecode. Fedora/Redhat has done this to an extent for some time. It'd be great to be able to do this under Gentoo as well.

    Tasks:

    • Create a 'JDK' which uses gcj as a backend. In this case, JDK really means providing a javac, javadoc, jar, etc
    • Have a way of keeping track of native bytecode
    • Integrate methods for native compiling into the current build system for building Java packages on Gentoo (ie eclasses)
    • Target native compilation of high profile applications, ie azreus, eclipse, freemind

    2a)

    Summary:

    Build maven entirely from source.

    Background:

    We currently only provide binary packages of maven, due to the fact that it is a bootstrapping nightmare because of the monolithic nature of the build process. The build system, at its basic level, does the following:

    • Build the 'core' maven functionailty using ant
    • Build the 'core' maven functionality using maven
    • Build all the plugins using maven

    The problem with building all the plugins at once is that there are a ton of plugins, with many, many dependencies. Because of these dependencies, it would make it impractical to have a monolithic package, which would be used to build other packages.

    Goals:

    • Have modular packages for maven
    • Have one package per plugin
    • Have a 'core' maven package
    • Have a 'minimal' maven package, which is core + minimal packages for compiling, javadocs, and jarring
    • Have a 'full' maven package which is all the plugins
    • Would need to work out a way to make the build much more modular

    2b)

    Summary
    Build packages using maven

    Background
    Many packages, particular Apache projects, have been switching over

    The main issue is getting jars from a maven repository. The normal behavior of maven is to download dependencies from a maven mirror. First
    of all, things at build time should not be using the network. Secondly, dependencies should be provided by jars from packages that have previously been emerged.

    Another issue is that maven 2 repositories contain metadata (specifically, pom.xml files) about the packages contained within. This is normally fetched from the repository, but since we don't want to be pulling from there, the question remains open as to where the metadata is gotten from and how its stored on the system.

    Goals:

    • Have a system to have maven use jars that we have built through portage
    • Update packages to use maven when possible. These should have fine grain control to the plugins that are available at build time. Packages should depend on the minimal install, and whatever extra plugins they might need, and only those should be available at build time.

    Possible solutions for dealing with maven repositories:
    A) Create a maven-repository like structure, and have it populated with jars from the system
    B) maven (2.0 at least) has a mechanism for providing alternative ways of fetching dependencies. We could then create an alternative way that's backed by portage.
    C) Find a way to tell maven not to fetch dependencies, and hope that there are the appropriate classes available on the classpath

    May 04, 2006 at 02:15 Permalink Edit Destroy

    Eclipse 3.1.2

    So, I've recently joined the dev-tools team in order to help maintain dev-util/eclipse-sdk. The ebuilds themselves haven't been touched much lately, aside from the occasional version bumps, and so have been in need of a little love.

    I've just added 3.1.2 to the tree recently. In terms of upstream changes since 3.1.1, there isn't too much to write home about. In terms of the ebuilds, I've manage clean up a number of things that would make mere mortals tremble. This isn't to say the ebuilds are quite ideal yet, but it is certainly a step in the right direction.

    In the coming weeks, I hope to continue sanitizing the Eclipse ebuilds, in addition to getting ready for the 3.2 release, which just entered release candidate last week.

    April 19, 2006 at 02:12 Permalink Edit Destroy

    Hello World

    Well, I got this blog setup the other week, so figured I should kick this thing off properly.

    Here you can expect to hear about the ongoings in the exciting world of Java on Gentoo. We have some awesome things in the woodwork, so stay tuned :)

    April 04, 2006 at 02:10 Permalink Edit Destroy