Reading in a framework-level resource in a Maven-built app
Reading in a framework-level resource in a Maven-built app
- Subject: Reading in a framework-level resource in a Maven-built app
- From: Paul Hoadley <email@hidden>
- Date: Sun, 02 Apr 2017 14:15:07 +0930
Hello,
I can see reference to this issue a couple of times in the list archives, but I’m not seeing the definitive solution. Could we quickly look at this again?
I have a file ‘foo.txt’ in Bar.framework at ‘src/main/resources/foo.txt’. In an application Baz dependent on Bar.framework, I want to load foo.txt, say as an InputStream. To be clear:
* Bar.jar is present at the appropriate place under Baz.woa/Contents/Resources/Java/.
* Bar.jar does contain foo.txt under its Resources folder.
* foo.txt is not present in Baz.woa/Contents/Resources.
All of this seems to be what I’d expect. Further, running out of Eclipse, something as simple as:
getClass().getClassLoader().getResource(BLACKLIST_FILENAME).toURI()
will get a URI for the file, because it can be found on the local filesystem. But if I close that project, forcing it to run using the framework JAR, neither that approach, nor WOResourceManager.inputStreamForResourceNamed() can find the file.
Anyway, rather than trying to debug any of the specifics of what I describe above, let me just ask a simple question: how can I load a framework resource at runtime in deployment given that the resource will be buried deep in a framework JAR?
--
Paul Hoadley
http://logicsquad.net/
https://www.linkedin.com/company/logic-squad/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden