Posted by ramapulavarthi
on October 10, 2008 at 2:31 PM PDT
There are different flavors of JAX-WS API based on the Maven repository you use, causing big confusion for the JAX-WS users. This blog talks about the workaround and direction for fixing the mess.
The problem: JAX-WS 2.1 API in Maven Central repository and Java.net 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 ..."
Java.net has two maven repositories, Java.net Maven 1 (M1) and Java.net 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 java.net 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 java.net M1. When the JAX-WS 2.1 API is final, the Maven Central repository is not synced up again to reflect the changes in Java.net M1 repo. So, we have different flavors of JAX-WS 2.1 API in Maven Central with incorrect dependencies and Java.net 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 java.net 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 Java.net 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 Java.net Maven repos to get all the JAX-WS artifacts.
Add the Java.net repositories to your project, so that Maven looks in these repos before it gets them from Maven central.
<name>Java.net Repository for Maven 1</name>
<name>Java.net 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 java.net 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.