Using web resources from Maven dependencies

Hi,


is anyone aware of a way to use JSPs that are contained in a maven dependency rather than in a directory on the file system?

I'm trying to make IntelliJ resolve JSP inclusions that are contained in an artifact that is accessible through Maven (but it's not a war file, but a custom bundling where web resources are contained in a non-standard path).

Thanks
Ben

5 comments
Comment actions Permalink

Hello.

Not sure. But can you elaborate: how does <dependency> element look, and what is the path to jsp in that bundling?

(It's also interesting, does the server you deploy the application work with such non-standard bundles: maybe IDEA miss some points in supporting some server.)

Thank you,
Alexander.

0
Comment actions Permalink

Hi ALexander,


thanks for replying.

The packaging is "content-package", and scope is (in this particular case) "provided".

The "content-package" packaging is defined by Adobe's content-package-maven-plugin [1] and is at the moment still proprietary to Adobe's AEM product offering, but in the process of being donated to the Apache Jackrabbit project along with other tooling around this packaging format [2], as it primarily offers packaging and tooling for JCR / Jackrabbit.

Providing support for that packaging in Eclipse is tracked in [3] (for reference, as some questions may be related).

Resources that should be resolvable are located in jcr_root/ in the package.
- so a quick workaround for me would be if there is some way to tell IntelliJ to look there instead of directly in the zip's root.

[1] http://dev.day.com/docs/en/cq/current/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html
[2] http://mail-archives.apache.org/mod_mbox/jackrabbit-dev/201305.mbox/%3CCAB+dfim97qLN=mV+DLEDdOvVSH5J6pUQ_2Nd9gBr7Djo3iNhsQ@mail.gmail.com%3E
[3] https://issues.apache.org/jira/browse/SLING-3100

Cheers
Ben

0
Comment actions Permalink

Hello.

Thank you for detailed answer and sorry for delay. I played with Adobe plugin in IDEA and it seems that there is no out-of-the-box support of such configuration. In the first head, because the set of supported dependency types is limited, and the zip is not supported (whatever is inside). See e.g.: http://youtrack.jetbrains.com/issue/IDEA-77967 and there some others.

I'm not completely sure how to configure

content-package-maven-plugin
plugin correctly (e.g. what is typical place to put JSP or web resources). If you like, you can attach a sample of 2 (or more) maven modules with described dependency and JSPs inside, maybe I'll find a way to configure them manually.

Regards,
Alexander.
0
Comment actions Permalink

Hi Alexander,


thanks for looking into this.

To make things easier, I have created a minimalistic sample setup that builds a content package providing and one consuming (i.e. including) a JSP and trying to work with objects defined in the providing package's JSP (which is a very common setup in the Sling/CQ/AEM world).
https://bitbucket.org/benpeter/content-package-sample

The artifacts/ folder contains the two maven artifacts produced from the projects. I copy the README below for reference in this thread.

Cheers
Ben

Both packagedeps-consumer and packagedeps-provider have been built from Adobe's simple-content-package-archetype: http://dev.day.com/docs/en/cq/current/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html#simple-content-package-archetype

provider contains a JSP src/main/content/jcr_root/apps/provider/global.jsp that defines objects.
consumer contains a JSP src/main/content/jcr_root/apps/consumer/components/sample/sample.jsp that includes /apps/provider/global.jsp and uses the objects defined therein.

consumer contains a dependency on provider. the setup is not a reactor, as this is trying to illustrate how to work with project external dependencies towards content packages.
If both results are deployed into Sling or AEM, the inclusion works well.

The IntelliJ part:
IntelliJ resolves inclusions within a project without a problem (even without setting up a Web facet).
However, the dependency on provider in the consumer project is not resolved in a way that allows the inclusion of /apps/provider/global.jsp to be resolved, so that the objects remain unresolved.

0
Comment actions Permalink

Thanks a lot.

Actually to resolve the reference to JSP the only necessary thing is a module dependency from consumer to provider, and once set manually, it works. However, Maven re-import removes this dependency because of its "unknown" type. Currently this is by design.

I've created a feature to support content-package: http://youtrack.jetbrains.com/issue/IDEA-118213

Regards,
Alexander.

0

Please sign in to leave a comment.