-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load Resources with Guava API #200
Load Resources with Guava API #200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many tests are failing when run through maven mvn test
for me with these changes.
Also, a few questions.
I am working on an update to address these issues. The unused imports were from refactoring and I forgot to remove them. I will admit that I am not familiar with Maven so I didn't know how to run the tests, but I have those running now and I will fix the initialization problems. For the SSR, I didn't realize it is also decompressing the stream, but I can update the code to handle that as well. I hope to have all these wrapped up soon. Thanks Chris! |
Haven't looked closely but I'm getting a single compilation error when running tests after the latest commits:.
Excited for these changes by the way. I'd been thinking about ways to get additional custom jars into ERDDAP, but the ability to compile ERDDAP as a jar usable in other projects is a great solution to customization! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes.
I am sorry that my initial pull requests had all of the tests failing but they pass now when I run locally. I brought back the File2 static initialization for tests and Two notes:
I built the erddap.war using mvn package and I verified it working in tomcat 10. Are there any other changes or documentation updates I should make for this pull request? |
Still getting one more error when running test, double checking now...
Ah, looks like we posted at the same time and this is a known issue! |
I'm working on deflaking tests in a separate branch: https://github.com/ChrisJohnNOAA/erddap/tree/ReduceTestFlakiness Given that, I think this is good to go. |
Description:
Compiling ERDDAP source into a jar file does not work due to the way ERDDAP accesses several static resource files. This change is to move the classpath resources into the main/resources source set, and patch the code to load classpath resources using the Guava Resources API. This fixes some of the assumptions that ERDDAP makes about the
WEB-INF/classes
directory, and allows the ERDDAP source to be bundled into builds as a jar file dependency.Resource files outside of the classpath remain in place. The code will still use filesystem paths for other directories within WEB-INF (e.g. cptfiles, ref, etc). This change should not impact any existing ERDDAP deployments since all files can remain where they are in the war artifacts.
Changes:
I wanted to additionally change the File2 WEB-INF directory lookup to use the ServletContext, but this would require changing the way EDStatic is initialized and make it dependent on the Erddap.init() method instead of the Erddap constructor. So WEB-INF parent directory is still located using the classpath of String2.java.