Hi Paul,

I’m sorry, I don’t have experience with the building with Maven aspect. It 
seems like while running with the project open in Eclipse that it can find the 
resources in the FrameworkName/Resources folder, so perhaps you could try using 
2 copies in your framework project, one in each place? It seems like the best 
solution is if Maven knew to get the resources out of the spot where they 
traditionally live. (As I recall, back in ProjectBuilder they were in 
FrameworkName/Resources as well.)

Good luck!
Mark


On Apr 2, 2017, at 2:58 AM, Paul Hoadley 
<pa...@logicsquad.net<mailto:pa...@logicsquad.net>> wrote:

Hi Mark,

On 2 Apr 2017, at 4:36 pm, Morris, Mark 
<mark.mor...@experian.com<mailto:mark.mor...@experian.com>> wrote:

I’m not sure if I’m missing the point of your question,

Sorry, it was a little bit unclear.

but WOResourceManager will find files in frameworks just fine if they’re in the 
Resources folder. Note that this is not under any XXX.woa/Contents/Resources 
path as mentioned in your email, you just put the files in the 
FrameworkName/Resources folder

I’m building with Maven, so I’ve put the resource in 
FrameworkName/src/main/resources...

and they end up under FrameworkName.framework/Resources within the jar.

Yep, confirmed.

You do have to supply the framework name in the call to WOResourceManager, such 
as:

InputStream is = 
WOApplication.application().resourceManager().inputStreamForResourceNamed( 
“foo.txt", “FrameworkName", aLanguagesList );

This where I might have rushed the question a bit. What I am after is code that 
works both when the framework is open in Eclipse, and when it’s not and it’s 
instead referencing the built JAR under ~/.m2/repository (or wherever). So if I 
close FrameworkName.framework in Eclipse, your code above does work. If I open 
it again, the InputStream returned is null. But what _does_ then work is:

URL url = getClass().getClassLoader().getResource(“foo.txt")

To be completely clear this time:

1. If framework project is closed in Eclipse (and application is hence using 
framework under ~/.m2/repository), 
WOResourceManager.inputStreamForResourceNamed() works fine.

2. If framework project is open, 
WOResourceManager.inputStreamForResourceNamed() returns null, but 
getClass().getClassLoader().getResource(“foo.txt") does return a URL that can 
be used.

So, to load a resource from a framework, I’ve got to try both methods. Is this 
expected behaviour for a Maven build, or am I doing something wrong?


--
Paul Hoadley
http://logicsquad.net/<https://urldefense.proofpoint.com/v2/url?u=http-3A__logicsquad.net_&d=DwMFaQ&c=BNNF-YNv0CLLslhP2Bcx5Q&r=R0ZqsewJs3eSJk7vLCqZv0r5kJlLXQLnGTeg9t8MlqA&m=XNYhJDwxsYlHPZAZ-2y60jwwN_KFjyr24irVn_ai14o&s=XafBhVABXRXPh656uFywRM30b9MHAzvL_5jFgL-m6ew&e=>
https://www.linkedin.com/company/logic-squad/




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to