[NPMCLI-129] jumpstart set relative path for magnolia.resources.dir Created: 04/Apr/17 Updated: 12/Apr/17 Resolved: 11/Apr/17 |
|
| Status: | Closed |
| Project: | Magnolia CLI |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.2.0 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Christopher Zimmermann | Assignee: | Federico Grilli |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: | |
| Sprint: | Basel 90, Basel 91 |
| Story Points: | 1 |
| Description |
|
Currently the jumpstart sets an absolute path in magnolia.properties for magnolia.resources.dir. So lets use a relative path instead. |
| Comments |
| Comment by Federico Grilli [ 05/Apr/17 ] |
|
I tried to quickly implement this but apparently magnolia doesn't like relative paths, e.g. Path relative to nearest apache tomcat (../light-modules) or magnolia app dir (../../../light-modules), i.e. /path/to/apache-tomcat/webapps/magnoliaAuthor I get
SEVERE: Exception sending context initialized event to listener instance of class info.magnolia.init.MagnoliaServletContextListener
java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at java.nio.file.Paths.get(Paths.java:84)
at info.magnolia.module.model.reader.LightModuleDefinitionReader.validateRootPath(LightModuleDefinitionReader.java:218)
|
| Comment by Christopher Zimmermann [ 05/Apr/17 ] |
|
I have done this on previous versions. |
| Comment by Federico Grilli [ 05/Apr/17 ] |
|
I had to prepend ${magnolia.home}/ to the relative path and then it worked. I was wondering though that this will only work if tomcat and light modules folders are always under the same directory (this is the assumption jumpstart makes), else the relative path won't be resolved correctly by Magnolia's directory watcher eventually. Not sure if we expect that tomcat and light-modules be always in the same directory. What we could do to mitigate such situation is to check upon mgnl start if the value of magnolia.resources.dir of the tomcat instance about to be started up points to a reachable folder. If not, inform user and don't proceed with starting up tomcat. |
| Comment by Christoph Meier [ 06/Apr/17 ] |
|
I am not astonished that magnolia.home or another sys. var known to tomcat with an absolute path is required to set magnolia.resources.dir "relative". I kindly ask you to not introduce a "coupling" of the tomcat folder and the light-modules folder. What the ticket asks for may cover the some use cases of some specific behaviour of some devs, but other devs may work completely different. But these are just my 2000VND ... |
| Comment by Christopher Zimmermann [ 06/Apr/17 ] |
|
cmeier fgrilli This ticket is just about the path that is set by jumpstart command which downloads a bundle and configures the magnolia.properties file for the dev in an opinionated way, currently with the absolute path. In that context I dont understand the danger of coupling. Do you agree or am i missing something? OK but now I see the obvious - this ticket would be helpful if a dev moves the entire top directory containing the apache and the light-modules - but is a problem if someone would just move the apache somewhere else. But I do think the first case is more common. |
| Comment by Christoph Meier [ 07/Apr/17 ] |
|
Ok. mgnl jumpstart -p /my/aboslute/path/to/my/light-modules-folder which then really will add the path as it was provided with the arg., then it is "fine for me" And, ok, i can see that some devs may want to move the complete "parent folder" - at least it is one possible use case. |