views:

171

answers:

1

I have a schemas.jar supplied to me and am trying to access it from within a simple Maven project. I have put the schemas.jar file in my src/main/resources directory, which is in my classpath.

When I am trying to access the created documents with something like:

GetOrdersRequestDocument getOrdersRequestDocument = GetOrdersRequestDocument.Factory.newInstance();

It complains about the GetOrdersRequestDocument (can't find it).

How do I get the project to pick up these classes? Do I need to import anything specific?

+1  A: 

I have put the schemas.jar file in my src/main/resources directory, which is in my classpath.

Yes, the files in src/main/resources directory are on your classpath. But this doesn't mean that the content of the jar itself is directly available. You could use a URLClassLoader to load the JAR though.

But... this is not how I would do things. If this is an option, I would just install the JAR in your corporate or local repository (using install:install-file) and declare it as a dependency. This would make the content of your JAR available to your code, like any other dependency.

Pascal Thivent
Once I did this I could then import the relevant classes and it worked. Thanks
Xetius