ZFIN-9917: Remove jars from source tree#1797
Conversation
The bin/, server/, and solr.xml were from an ancient ~6.x era Solr distribution, completely superseded by the solr:8.11.3 Docker image. The dataimporthandler jars in site_index/lib/ were version 8.6.3 and already loaded from the Docker image's /opt/solr/dist/ via solrconfig.xml. The old postgresql JDBC driver (9.4.1210) is replaced by a Gradle-managed dependency in the next commit.
Add deploySolrJdbc Gradle task that copies the postgresql jar from runtimeClasspath to $SOLR_HOME/lib/, called by ant deploy-solr. Also aligns test postgresql dependency (42.2.18 -> 42.7.8) with prod.
…ation Download the jar at build time instead of checking it into the repo.
Use the same ADD --checksum approach as the Tomcat Dockerfile. This removes the need for the deploySolrJdbc Gradle task and Ant wiring.
Define postgresqlVersion once in buildscript.ext and reference it in all Gradle dependency declarations. Upgrade SchemaSpy from broken 5.0.0 (jar was missing) to 6.2.4 via Gradle dependency, use -vizjs for built-in diagram rendering, and fix DB user to use PGUSER.
These jars are already declared as Gradle dependencies and get copied from runtimeClasspath during deployment, overwriting these checked-in copies. The remaining 9 jars in WEB-INF/lib match the localFileDependencies list — jars not available via Maven that must be checked in.
JSObject.class and JSException.class are ancient Netscape plugin API artifacts with zero references anywhere in the codebase.
The tomcat-juli-extra.jar (v7.0.32) and tomcat-juli-adapters.jar (v7.0.30) were used to route Tomcat JULI logging to log4j 1.x. These jars are from Tomcat 7 but the Docker image runs Tomcat 10, which dropped JULI extras entirely. Tomcat 10's built-in JULI logging already writes to catalina.out and console by default. Also removes the now-unnecessary bin/ copy from the Ant create-mutant-instance target.
Smoke test targets (smokeTests, productionSmokeTests, smokeTestsReadWrite, smoke) now delegate to Gradle via `gradle test -Psuite=<SuiteName>`, matching the pattern already used by the `test` target. The email notification on failure (handleSmokeFailure) is preserved for productionSmokeTests. This allows removing the 18 checked-in jwebunit jars from lib/Java/jwebunit/ since Gradle already declares equivalent dependencies (jwebunit-core 2.4/3.3, htmlunit 2.70.0, etc.) as testImplementation. Also removes SmokeTestsReadWrite.java from Gradle's test source exclusion list so it can be compiled and run via Gradle.
Removes standard Maven jars from lib/Java/gwt/ that are already available via Gradle dependencies: jackson-annotations-2.15.2, jakarta.ws.rs-api-3.1.0, jakarta.xml.bind-api-3.0.1, and validation-api-1.0.0.GA (+sources). The 5 eclipse-transformed jars (gwt-dev, gwt-jackson, jsinterop, jackson-annotations-2.8.2-sources) and gwt-user are kept because they contain javax->jakarta namespace transformations needed for Tomcat 10 compatibility, or have no Maven equivalent. Also updates the gwtCompile task to pull standard deps from Gradle's compileClasspath instead of the fileTree, and fixes a broken localFileDependencies reference (jsinterop filename mismatch). Remove unused zip files from lib/Java
… 2.11.0 Replace the 41 MB fat JAR (GWT 2.8.2 with javax->jakarta transformation and all bundled dependencies) with Maven-resolved gwt-dev 2.11.0 which natively supports jakarta.servlet. - Update GWT compilation classpath in both compileGwtModule and gwtCompile tasks to use configurations.compileClasspath with proper ordering - Add org.w3c.css:sac:1.3 dependency for UiBinder CSS processing - Filter jackson-annotations sources JAR from Maven (incompatible with GWT JRE emulation); local eclipse-transformed version is used instead - Remove unused server-side imports from GWT-visible source files: LookupStrings.java (Spring Model), RelatedEntityDTO.java (Publication), ExpressionCurationService.java (@PathVariable), FeatureAddView.java (javassist) - Inline LookupStrings.idNotFound() into its 2 callers and remove the method - Add analysis document in docs/ Replace 7 checked-in GWT jars with Maven dependencies Use full compileClasspath (denylist filter) instead of cherry-picking individual jars. Only 2 jars remain in lib/Java/gwt/ that can't come from Maven: jackson-annotations-2.8.2-sources-eclipse-transformed.jar (GWT JRE emulation incompatibility) and gwt-jackson-0.15.0-eclipse-transformed.jar (contains .java sources needed for GWT client compilation). Add some documentation around the remaining jar files that are needed for gwt Eliminate last 2 checked-in GWT jars, replace with Maven dependencies - Remove gwt-jackson-0.15.0-eclipse-transformed.jar (Maven 0.15.4 includes sources) - Remove jackson-annotations-2.8.2-sources-eclipse-transformed.jar - Add gwtSources configuration to pull jackson-annotations 2.11.4 sources (newest GWT-compatible version; 2.12+ uses String.format unsupported by GWT) - Exclude gwtSources from Jackson version resolution strategy to prevent Gradle from upgrading it to the GWT-incompatible 2.15.2 - Add GWT-JACKSON-NOTES.md documenting the constraints lib/Java/gwt/ now contains only documentation, no jars.
|
More information on the refactorings to remove some of the gwt-related jars: Analysis: gwt-dev-eclipse-transformed.jarWhat it isA fat/uber JAR (41 MB, 22,672 entries, 17,622
Bundled dependencies
How it's usedIn
|
| File | Removed import | Reason |
|---|---|---|
LookupStrings.java |
org.springframework.ui.Model |
Used only in idNotFound() method, which was server-side only. Method inlined into the 2 callers (ShowPublicationController, OrthologyController) and removed. |
RelatedEntityDTO.java |
org.zfin.publication.Publication |
Completely unused import (Publication has Hibernate annotations GWT can't compile). |
ExpressionCurationService.java |
org.springframework.web.bind.annotation.PathVariable |
Unused import (code uses @PathParam from Jakarta WS-RS instead). |
FeatureAddView.java |
javassist.compiler.ast.StringL |
Completely unused import. |
2. Missing CSS SAC dependency
GWT's UiBinder needs org.w3c.css.sac.CSSException for processing CSS in .ui.xml templates. The old fat JAR bundled cssparser-0.9.18 which included this. GWT 2.11.0's transitive dependencies don't include it.
Fix: Added compileOnly "org.w3c.css:sac:1.3" to build.gradle.
3. Jackson annotations sources JAR conflict
gwt-jackson:0.15.4 declares a dependency on jackson-annotations with the sources classifier (standard for GWT libraries). Maven resolves this to jackson-annotations-2.15.2-sources.jar, which uses String.format(String, Set<String>) — not supported by GWT's JRE emulation.
Fix: Filtered jackson-annotations-*-sources.jar from the GWT compilation classpath. The local lib/Java/gwt/jackson-annotations-2.8.2-sources-eclipse-transformed.jar provides a compatible version.
4. Stale UiBinder XML templates in build output
sourceSets.main.output includes build/resources/main/ which contained outdated copies of .ui.xml template files (missing ui:field attributes that exist in the current source). When placed first on the classpath, GWT found the stale templates instead of the current ones.
Fix: Changed classpath ordering to put files('source') first, then files('home/WEB-INF/classes') for compiled bytecode, then Maven dependencies.
5. Compiled classes not on GWT classpath
configurations.compileClasspath does not include the compiled output directory (home/WEB-INF/classes). Classes like LookupStrings and View that are referenced by GWT client code but live outside GWT <source> paths need to be available as bytecode.
Fix: Explicitly added files('home/WEB-INF/classes') to the GWT compilation classpath.
Final classpath configuration
// Filter out jackson-annotations-*-sources.jar from Maven;
// the local eclipse-transformed sources JAR in lib/Java/gwt/ is used instead.
def filteredCompileClasspath = configurations.compileClasspath.filter { file ->
!file.name.matches('jackson-annotations-.*-sources\\.jar')
}
classpath = files('source') +
files('home/WEB-INF/classes') +
filteredCompileClasspath +
fileTree(dir: 'lib/Java/gwt', include: '*.jar')Classpath ordering matters:
source/— GWT module source files and.ui.xmltemplates (must be first to avoid stale copies)home/WEB-INF/classes/— compiled bytecode for non-GWT classes referenced by GWT codeconfigurations.compileClasspath— Maven-resolved dependencies includinggwt-dev:2.11.0and transitive depslib/Java/gwt/*.jar— local GWT JARs (gwt-user,validation-api-sources,jackson-annotations-sources-eclipse-transformed, etc.)
Files changed
build.gradle— updated GWT compilation classpath, addedorg.w3c.css:sac:1.3dependencylib/Java/gwt/gwt-dev-eclipse-transformed.jar— deleted (41 MB)source/org/zfin/framework/presentation/LookupStrings.java— removed Spring import andidNotFound()methodsource/org/zfin/gwt/root/dto/RelatedEntityDTO.java— removed unusedPublicationimportsource/org/zfin/gwt/curation/ui/ExpressionCurationService.java— removed unused@PathVariableimportsource/org/zfin/gwt/curation/ui/feature/FeatureAddView.java— removed unusedjavassistimportsource/org/zfin/publication/presentation/ShowPublicationController.java— inlinedidNotFound()logicsource/org/zfin/orthology/presentation/OrthologyController.java— inlinedidNotFound()logic
| # and the build.gradle file (for the web app) as well. (Also update the checksum.) | ||
| ADD --checksum=sha256:2a32a9dcbc42d67a50ad3a0de5efd102c8d2be46720045f2cbd6689f160ab7c7 \ | ||
| https://jdbc.postgresql.org/download/postgresql-42.7.8.jar \ | ||
| /usr/local/tomcat/lib/postgresql-42.7.8.jar |
There was a problem hiding this comment.
Can this be part of the deploy process instead of the image definition? That would keep the version numbers in sync
There was a problem hiding this comment.
@cmpich after looking into this a bit, I realized the problem with deploying it from our compile container is that the compile container and the tomcat container do not share the /usr/local/tomcat/ path
| ADD --checksum=sha256:2a32a9dcbc42d67a50ad3a0de5efd102c8d2be46720045f2cbd6689f160ab7c7 \ | ||
| https://jdbc.postgresql.org/download/postgresql-42.7.8.jar \ | ||
| /var/solr/data/site_index/lib/postgresql-42.7.8.jar | ||
|
|
There was a problem hiding this comment.
Same as comment on tomcat Dockerfile: Can we deploy this file using our standard build process?
42.7.8in both the Solr and Tomcat Docker images, now fetched directly from the official source with a SHA256 checksum for integrity.org.postgresql:postgresqlto use a variable (postgresqlVersion) instead of a hardcoded version so we can match the same version everywhere more easily