netarchivesuite / solrwayback

A search interface and wayback machine for the UKWA Solr based warc-indexer framework.
Apache License 2.0
102 stars 21 forks source link

Does not build on jre 17 (resp. starting from jre 15) due to missing nashorn #453

Closed white-gecko closed 4 months ago

white-gecko commented 4 months ago

I try to build the solrwayback war with mvn package resp. mvn package -DskipTests on jre17 but it fails with …/solrwayback/src/test/java/dk/kb/netarchivesuite/solrwayback/javascript/JavascriptTests.java:[5,33] package jdk.nashorn.api.scripting does not exist.

Nashorn was removed in version 15.

JEP 372: Remove the Nashorn JavaScript Engine https://openjdk.org/jeps/372

Full log output.

$ mvn package -DskipTests
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------< dk.kb.netarchivesuite.solrwayback:solrwayback >------------
[INFO] Building solrwayback 5.1.1
[INFO]   from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- frontend:1.10.0:install-node-and-npm (Install node and npm) @ solrwayback ---
[INFO] Node v16.18.0 is already installed.
[INFO] NPM 8.19.2 is already installed.
[INFO] 
[INFO] --- frontend:1.10.0:npm (Install JS dependencies (npm install)) @ solrwayback ---
[INFO] Running 'npm install' in …/solrwayback/src/js
[INFO] 
[INFO] up to date, audited 1167 packages in 5s
[INFO] 
[INFO] 136 packages are looking for funding
[INFO]   run `npm fund` for details
[INFO] 
[INFO] 17 vulnerabilities (13 moderate, 4 high)
[INFO] 
[INFO] To address issues that do not require attention, run:
[INFO]   npm audit fix
[INFO] 
[INFO] To address all issues (including breaking changes), run:
[INFO]   npm audit fix --force
[INFO] 
[INFO] Run `npm audit` for details.
[INFO] 
[INFO] --- frontend:1.10.0:npm (Build frontend distribution for PRODUCTION (npm run build)) @ solrwayback ---
[INFO] Running 'npm run build' in …/solrwayback/src/js
[INFO] 
[INFO] > solrwayback@0.0.1 build
[INFO] > rimraf dist && cross-env node_modules/.bin/vue-cli-service build
[INFO] 
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] All browser targets in the browserslist configuration have supported ES module.
[INFO] Therefore we don't build two separate bundles for differential loading.
[INFO] 
[INFO] 
[INFO] -  Building for production...
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO] Browserslist: caniuse-lite is outdated. Please run:
[INFO]   npx update-browserslist-db@latest
[INFO]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[INFO]  WARNING  Compiled with 3 warnings3:53:37 PM
[INFO] 
[INFO] [eslint] 
[INFO] …/solrwayback/src/js/src/components/AboutComponent.vue
[INFO]   3:54  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
[INFO] 
[INFO] …/solrwayback/src/js/src/components/modalComponents/CollectionInfo.vue
[INFO]   3:10  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
[INFO] 
[INFO] …/solrwayback/src/js/src/components/modalComponents/SearchGuidelines.vue
[INFO]   3:10  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
[INFO] 
[INFO] …/solrwayback/src/js/src/components/searchSingleItemComponents/SearchSingleItemStandardInfo.vue
[INFO]   45:37  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
[INFO] 
[INFO] ✖ 4 problems (0 errors, 4 warnings)
[INFO] 
[INFO] 
[INFO] You may use special comments to disable some warnings.
[INFO] Use // eslint-disable-next-line to ignore the next line.
[INFO] Use /* eslint-disable */ to ignore all warnings in a file.
[INFO]  warning  
[INFO] 
[INFO] asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
[INFO] This can impact web performance.
[INFO] Assets: 
[INFO]   static/js/366.449f0c3f.js (595 KiB)
[INFO]   static/js/chunk-vendors.61c7eb6d.js (1.05 MiB)
[INFO] 
[INFO]  warning  
[INFO] 
[INFO] entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
[INFO] Entrypoints:
[INFO]   app (1.24 MiB)
[INFO]       static/css/chunk-vendors.a0d48633.css
[INFO]       static/js/chunk-vendors.61c7eb6d.js
[INFO]       static/css/app.1ed2f09a.css
[INFO]       static/js/app.ea4d1a84.js
[INFO] 
[INFO] 
[INFO]   File                                      Size             Gzipped
[INFO] 
[INFO]   dist/static/js/chunk-vendors.61c7eb6d.    1072.75 KiB      317.37 KiB
[INFO]   js
[INFO]   dist/static/js/366.449f0c3f.js            595.29 KiB       165.74 KiB
[INFO]   dist/static/js/app.ea4d1a84.js            133.92 KiB       34.64 KiB
[INFO]   dist/static/js/harvest-calendar.72d607    60.12 KiB        17.15 KiB
[INFO]   b4.js
[INFO]   dist/static/js/611.1ab2667d.js            13.73 KiB        3.88 KiB
[INFO]   dist/static/js/page-harvest-data.15b12    7.03 KiB         2.29 KiB
[INFO]   22d.js
[INFO]   dist/static/js/PWID.07893d4e.js           1.79 KiB         0.88 KiB
[INFO]   dist/static/js/845.75beca31.js            1.05 KiB         0.58 KiB
[INFO]   dist/static/js/94.7d779f77.js             1.05 KiB         0.58 KiB
[INFO]   dist/static/js/117.d83e5fbc.js            1.05 KiB         0.58 KiB
[INFO]   dist/static/js/918.0132c20b.js            0.99 KiB         0.55 KiB
[INFO]   dist/static/js/about.92c41af7.js          0.49 KiB         0.36 KiB
[INFO]   dist/static/css/app.1ed2f09a.css          45.91 KiB        8.87 KiB
[INFO]   dist/static/css/366.edcd26bb.css          39.47 KiB        10.23 KiB
[INFO]   dist/static/css/chunk-vendors.a0d48633    17.59 KiB        6.79 KiB
[INFO]   .css
[INFO]   dist/static/css/harvest-calendar.87c44    2.79 KiB         0.96 KiB
[INFO]   8de.css
[INFO]   dist/static/css/page-harvest-data.2ebd    2.00 KiB         0.79 KiB
[INFO]   1a17.css
[INFO]   dist/static/css/PWID.0d58dde8.css         0.54 KiB         0.34 KiB
[INFO] 
[INFO]   Images and other types of assets omitted.
[INFO]   Build at: 2024-06-18T13:53:37.246Z - Hash: 35c9ab76c6cae403 - Time: 14394ms
[INFO] 
[INFO]  DONE  Build complete. The dist directory is ready to be deployed.
[INFO]  INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
[INFO]        
[INFO] 
[INFO] --- resources:3.1.0:resources (default-resources) @ solrwayback ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO] 
[INFO] --- compiler:3.5.1:compile (default-compile) @ solrwayback ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 129 source files to …/solrwayback/target/classes
[INFO] …/solrwayback/src/main/java/dk/kb/netarchivesuite/solrwayback/solr/SolrStreamDirect.java: Some input files use or override a deprecated API.
[INFO] …/solrwayback/src/main/java/dk/kb/netarchivesuite/solrwayback/solr/SolrStreamDirect.java: Recompile with -Xlint:deprecation for details.
[INFO] …/solrwayback/src/main/java/dk/kb/netarchivesuite/solrwayback/util/SolrUtils.java: Some input files use unchecked or unsafe operations.
[INFO] …/solrwayback/src/main/java/dk/kb/netarchivesuite/solrwayback/util/SolrUtils.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- resources:3.1.0:copy-resources (copy-resources) @ solrwayback ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory …/solrwayback/src/test/jetty
[INFO] 
[INFO] --- resources:3.1.0:testResources (default-testResources) @ solrwayback ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 100 resources
[INFO] 
[INFO] --- compiler:3.5.1:testCompile (default-testCompile) @ solrwayback ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 52 source files to …/solrwayback/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] …/solrwayback/src/test/java/dk/kb/netarchivesuite/solrwayback/javascript/JavascriptTests.java:[5,33] package jdk.nashorn.api.scripting does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27.285 s
[INFO] Finished at: 2024-06-18T15:53:41+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile (default-testCompile) on project solrwayback: Compilation failure
[ERROR] …/solrwayback/src/test/java/dk/kb/netarchivesuite/solrwayback/javascript/JavascriptTests.java:[5,33] package jdk.nashorn.api.scripting does not exist
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
VictorHarbo commented 4 months ago

I've had a go on this on the branch named explicit_include_nashorn. Which isn't including nashorn at all, but in fact changing to GraalVM. there's an open PR on that branch.

If you want to you are welcome to test if you can build that branch?

thomasegense commented 4 months ago

Yes, is a known problem. But hard to fix so it works both under java11 and java17. Solution is probably just to disable that unittest. The java javascript engine is not used runtime. 'Runtime' it uses the brower. That happens when backenders write javascript :)

thomasegense commented 4 months ago

I have disabled the unittest.Rrenamed file to non-java since imports would also break build. The unittest will be enabled when there is a javascript engine what will work both under java11 and java 17.

Also Nashhorn engine was programmatically patched in start of the unittest to make it act as modern browsers by adding a method. Horrible solution. GONE! Closing this issue.