In typical Java EE maven project I put resources in src/main/resources and access files with getResourceAsStream(). How to work relative to the current class has been dicussed in this thread. However, I would need an absolute way to access resources. Background of this question is that I would like to use owner config with fallback to a classpath property file. Thanks for help. asked 20.09.2017 at 06:42 adamf |
Hi Adam Create a new folder in your axonivy project, add the folder to your classpath (as shown below) and then make sure you path starts with a forward-slash (e.g. Also here's a sample project: https://drive.google.com/file/d/0B3V8Sh7Fl7FXWHRxcEw2T29PdkU/view?usp=sharing Cheers Lars answered 20.09.2017 at 13:02 Lars Tuchel Hi @Lars, your example works in Developer, but when deploying on Axon.ivy Engine it throws a NPE (Cannot find the resource). Anything to take care of when deploying on Axon.ivy Engine?
(20.09.2017 at 15:31)
adamf
Hi @adamf When you build your project with maven, make sure you add your folder as resources folder in the pom.xml. See https://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html
(22.09.2017 at 10:15)
Lars Tuchel
This approach using maven resource still does not work on the stand alone engine for me. Please check that this approach works also on engine before accepting.
(25.09.2017 at 09:11)
adamf
can you check whether the resource really exist in the built IAR file? Maybe it is not because some files are filtered by default. You may want to play around with the related parameters of the maven plugin to steer the file inclusion in ivy archives. http://axonivy.github.io/project-build-plugin/release/7.0/pack-iar-mojo.html
(26.09.2017 at 09:46)
Reguel Werme... ♦♦
Hi @Reguel, yes it includes the resources in IAR file. But it looks like in the engine only resources in one of the default src_ folders are considered. It does not matter so much, as there is no real use case for this in Ivy. And one can cope with having java classes mixed with resources if one really needs them.
(24.10.2017 at 06:36)
adamf
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 20.09.2017 at 06:42
Seen: 2,908 times
Last updated: 24.10.2017 at 06:37
So working with relative path annotating my owner config with @Config.Sources({"classpath:./MyConfig.properties"}), but this requires having property file in same directory as java files.
The "ivy way" is probably to use the configuration system for configs and other resources as texts or images to CMS system and use Ivy.cms().getContentObject(path) ?