You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/08/01 10:02:35 UTC

[Bug 66191] New: compile taglibs that are not (yet) included in jsp file

https://bz.apache.org/bugzilla/show_bug.cgi?id=66191

            Bug ID: 66191
           Summary: compile taglibs that are not (yet) included in jsp
                    file
           Product: Tomcat 10
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: andreas.stange@rmcon-int.de
  Target Milestone: ------

## Issue Description
We are using jetty-jspc-maven-plugin (which uses Jasper JspC) to compile jsp
and tag files 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 the jsp compiler 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.

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

## Additional Notes
I was redirected here from the jetty-jspc-maven-plugin team:
https://github.com/eclipse/jetty.project/issues/8316

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66191] compile taglibs that are not (yet) included in jsp file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66191

--- Comment #3 from andreas.stange@rmcon-int.de ---
> Given that the compilation of the tag files is simply a means to an ends
> (dependency management) I wonder if there is a simpler solution.

We could write a test that scans our tag files to check that no import of a
prematurely used class exists.

However, the JSP compiler has info what is on the classpath, transitive
dependencies etc. Thus, I argue that compilation would be the better solution.

When not compiling tag files, errors will always be delayed to later projects.
For example, unsupported Java language features (depends on language level
configuration) or syntax errors. But yes, this is a minor issue because the
error will show up eventually.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66191] compile taglibs that are not (yet) included in jsp file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66191

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Moving this to an enhancement.

Given that the compilation of the tag files is simply a means to an ends
(dependency management) I wonder if there is a simpler solution.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66191] compile taglibs that are not (yet) included in jsp file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66191

andreas.stange@rmcon-int.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from andreas.stange@rmcon-int.de ---
> The prematurely used Java files are not present. Thus no error.

Should be "The prematurely used Java files are NOW present. Thus no error."

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 66191] compile taglibs that are not (yet) included in jsp file

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66191

Dan Caseley <da...@caseley.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dan@caseley.me.uk

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org