Eclipse woes with Maven on OSX
UPDATED NOTE: My Maven dependency wasn’t updating because I had my ArtifactID wrong, but what is concerning is that the unmarshaller didn’t even blink and eye at unmarshalling the document wrong after I modified the XML Schema
Well, I fired up the spring boot application I’ve been working on that includes unmarshaller and marshaller the spring way when I notice something when I simply did the following:
JAXBDoc doc = m.unmarshallXml(inDoc);
System.out.println(sBuilder.append("MARSHALLED_DOC:\n").append(m.marshallXml(doc)));
Well my document that I just unmarshalled and marshalled did not come out right at all! I was missing elements! No Errors to warn me! Luckily I noticed this, later on in development it would probably taking longer to dig through layers of code muck. Well I realized that my schema had changed and it wasn’t generating the new structure.
My application relies on a custom JAXB library, my troubleshooting led to that maven was not updating the JAXB jar file in the “.m2″ directory. Well I tried to delete it in the “.m2″ hoping that a rebuild would fix it. It made matters worse, even though the dependency rebuilt and placed in the .m2 directory, Eclipse failed to see it. I did the normal stuff googling suggests like rebuild the project, force maven update Snapshots/Releases. Just no luck. To get the eclipse to update, I had to remove the project with the Application in it (the dependent maven project) and reimport it into the Eclipse IDE.
It is pretty concerning to me that this can happen. I’ve had issues in the past where stale jaxb libraries are picked up by the classloader instead of my jaxb lib, but that is because of external conflicts. I shouldn’t have to worry about internal conflicts like this in 2017.