Skip to main content

JAX-WS API Version Mess with Maven

Posted by ramapulavarthi on October 10, 2008 at 2:31 PM PDT

The problem: JAX-WS 2.1 API in Maven Central repository and Maven repository are not in sync. Based on the repository you configured in your project, you may get different flavors of the API. This often results in to compilation errors using JAX-WS Maven plugin. for example, you may get "Caused by: java.lang.NoClassDefFoundError: javax/jws/WebService ..."

Some background: has two maven repositories, Maven 1 (M1) and Maven 2( M2). As you know, JAX-WS RI's artifacts and dependencies are scattered in both of these repositories. [ There have been some requests to post everything into M2 repository, and we are working on that. We are just continuing pushing to the M1 repo just so that people using that repo would still find the updated versions of JAX-WS. We are pushing all the new JAX-WS extensions to M2 repo. As mentioned, we are working on syncing both the repos moving forward.]

While we were working on the JAX-WS 2.1 API, it was mistakenly pushed multiple times as 2.1 instead of as 2.1-SNAPSHOT with an automated job. In the meanwhile, some folks synced up the Maven Central repository with M1. When the JAX-WS 2.1 API is final, the Maven Central repository is not synced up again to reflect the changes in M1 repo. So, we have different flavors of JAX-WS 2.1 API in Maven Central with incorrect dependencies and M1 with the correct dependencies under the same groupId and artifactId.

Then some folks have realized about the discrepancy and tried to fix the problem in Maven central repo. Since they could n't sync up the updated version 2.1 again, they bumped up the version to 2.1-1 to reflect the updated JAX-WS 2.1 API on M1 as discussed here. But JAX-WS 2.1.X RI and its associated maven plugin still depend on 2.1 version, so the jax-ws api you get still depends on which repo you are fetching from. We could have updated our RI to use the 2.1-1 to fix it and end of the problem, right? Not exactly. JAX-WS 2.1 API depends on revised version of JSR 181 API (which we pushed on to M1 as "jsr181-api 1.0-MR1"). Seems there is a rule that all the artifacts in Maven central should have its dependecies also in Maven central. Since "jsr181-api 1.0-MR1" is not there in Maven central, When the Maven Central was updated with JAX-WS 2.1-1 version of API, they modified the dependencies to use "jsr181-api 1.0". For all your JAX-WS dependent apps to work correctly, we cannot use "jsr181-api 1.0", there have been lot of changes that went in to JSR 181 Maintenance release to sync up with JAX-WS 2.0. So, We cannot use JAX-WS API 2.1-1 in Maven central. These different versions confuses lots of JAX-WS users as we can see from the maven related discussions in the Metro forum.

If you already have a version of JAX-WS API 2.1 checked out from Maven Central, clean your local repo and use Maven repos to get all the JAX-WS artifacts.

Add the repositories to your project, so that Maven looks in these repos before it gets them from Maven central.

            <name> Repository for Maven 1</name>
            <name> Repository for Maven 2</name>

Fix the Mess:
So, we have messed up versions of JAX-WS API everywhere, what do we do now. The solution would be, if BEA pushes the updated jsr181-api into Maven Central repo, We can modify JAX-WS API to use it and bump up the version to 2.1-2 (following the convention started at Maven Central) and push it to M1 and Maven central. But I am little hesitant with this versioning convention, as there is no JAX-WS 2.1.2 specification and an api with 2.1-2 associated with Spec version 2.1 would be confusing. The future JAX-WS Specification would be JAX-WS 2.2 if it goes for another maintenence. Then we would have to wait until JAX-WS 2.2 comes out to fix this. I guess going with 2.1-2 is better than living with these broken dependencies. What do you prefer?

I hope we fix this soon.

Related Topics >>


I have issued the bugs 891

I have issued the bugs 891 and 892 before I actually found this very article via stackoverflow. So it is not clear, why it is not possible to re-deploy artifacts to Maven central two years afterwards? I vote for fixing things!


javax/jws/jsr181-api/1.0-MR1 seems to be on central now
Is there any chance of a fix?

How about versioning it as 2.1-FINAL? Why is stuff scattered between the maven/1 and maven/2 repositories? I can understand why some stuff does not make it to maven central if there is licensing issues, but to have you own repositories fragmented...? Its a mess and makes you look very incompetent, sort it out!

Rama, One another workaround is to use the geronimo version of the spec jar -

In cases where just the Maven POM was wrong but the actual artifacts didn't change at all, I have pushed new POMs without updating the version number. I think the POM should be regarded as metadata that is treated independently of the artifacts it describes.