пт, 8 окт. 2021 г. в 11:18, Mark Thomas <ma...@apache.org>:
>
> On 07/10/2021 20:59, Konstantin Kolinko wrote:
> > чт, 7 окт. 2021 г. в 18:46, Mark Thomas <ma...@apache.org>:
>
> <snip/>
>
> >> Is this a problem worth solving? If it is, is there a better way?
> >
> > Hi!
> >
> > Last few days I was thinking of the following approaches:
>
> <snip/>
>
>
> e) is certainly the more elegant solution but it does have some admin
> we'd need to do. a) is less elegant but avoids the admin.  Maybe
> implement a) as a stop-gap while we see if e) is possible?
>

f)
Looks a bit like c) but another way around, combined with a):

1. Introduce new property
common-legacy.loader="${catalina.base}/lib/legacy/*.jar"

2. ECJ JARa are at the following locations:
${catalina.base}/lib/legacy/ecj-4.6.3.jar
- moved to legacy,
${catalina.base}/lib/ecj-4.20.jar
- added to the regular libs directory.

3. Attempt to load either
"org.eclipse.jdt.internal.compiler.batch.Main" class (their Main-Class)
or
"org.eclipse.jdt.internal.compiler.tool.EclipseCompiler" class (as
specified in their META-INF/services/javax.tools.JavaCompiler file)
or some other class usually used by Jasper (I have not checked the code).

If an attempt to load fails with
java.lang.UnsupportedClassVersionError (i.e. running with Java 7),
then exclude the library and use the paths in common-legacy.loader
property as fallback.

We routinely preload several classes at startup. An attempt to load
one more class is not much work. Loading it specifically from
ecj-4.20.jar and excluding that jar from classpath is some work/magic
to be done.


Additional notes:
a. The dependency on ECJ jar for users of Apache Maven is specified in
res/maven/tomcat-jasper.pom as

    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>ecj</artifactId>
      <version>3.12.3</version>
    </dependency>

If someone needs a newer version they may override the dependency.

b. Tomcat should be able to start successfully with no ECJ jar at classpath.
E.g. if somebody has already precompiled all their JSPs elsewhere, and
wants to run with no support for compilations of the JSPs.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to