Skip to content
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

[jetty-jspc-maven-plugin] compile taglibs that are not (yet) included in jsp file #8316

Closed
achimmihca opened this issue Jul 18, 2022 · 4 comments

Comments

@achimmihca
Copy link

achimmihca commented Jul 18, 2022

Jetty version
jetty-jspc-maven-plugin 9.4.43.v20210629

Java version
17

Issue Description
We are using jetty-jspc-maven-plugin to compile JSP in our build.
We have some maven-projects that contain only taglibs (tld files) but no jsp files.
Sadly, these taglibs are not compiled when the project is compiled.

It seems jetty-jspc-maven-plugin does a top to bottom approach, starting with jsp files and including everything in the compilation that is reachable from these.
Because our taglib project does not contain a jsp file, nothing is compiled.

When including tag files explicitly ( <includes>**/*.tag, **/*.jsp, **/*.jspx</includes> ) then these are still considered as jsp files and it results in an error: [&lt;%@ tag] directive can only be used in a tag file

Desired Solution
Include an option compileUnusedTaglibs (name is only a suggestion).
It should search for tld files and compile everything that is reachable from these.

Motivation
At the moment, our taglib is only compiled as part of a later project.
Sadly, project dependencies are not enforced because of this.

Example:

  • TaglibProject is Referenced by WebAppProject.
  • TaglibProject uses Java classes from WebAppProject prematurely in tag files
  • TaglibProject tag files are not compiled yet. Thus no error.
  • WebAppProject is compiled. The prematurely used Java files are not present. Thus no error.

It works. But it would be better for our project structure, if it would not be possible to use classes from later projects prematurely in tag files or earlier projects. taglib compilation would enforce this.

Workaround: Create a dummy jsp file that includes the tag files of the taglib project. They will be compiled then because they are reachable from a jsp file.

@achimmihca
Copy link
Author

You can find here a small example project setup to reproduce the issue: https://github.com/achimmihca/multi.module.webapp.demo

@achimmihca
Copy link
Author

Workaround: Create a dummy jsp file that includes the tag files of the taglib project. They will be compiled then because they are reachable from a jsp file.

Does not seem to work because JSP files cannot be placed in taglib projects (see #8317 for details)

@janbartel
Copy link
Contributor

@achimmihca I think this is in the same category as #8317, in that this is the way that jspc is working, so would need an issue raised over at Apache Jasper?

@achimmihca
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants