papegaaij opened a new issue, #1832:
URL: https://github.com/apache/wicket/issues/1832
### Description
A second `mvn install` without `clean` fails in `wicket-extensions`, in the
`resources-optimizer-maven-plugin`:
```
mvn clean install -DskipTests -Pfast -pl wicket-extensions -am # succeeds
mvn install -DskipTests -Pfast -pl wicket-extensions -am # fails
```
```
[ERROR] JSC_NON_CONST_DEFINE. @define $jscomp.ASSUME_ES5 has already been
set at src/com/google/javascript/jscomp/js/util/defines.js:25:8. at
.../wicket-extensions/target/classes/org/apache/wicket/extensions/ajax/veil/wicket-veil.min.js
line 1 : 243
...
[ERROR] Failed to execute goal
org.primefaces.extensions:resources-optimizer-maven-plugin:2.7.9:optimize
(default) on project wicket-extensions: Resources optimization failure:
Resources optimization failure. Please fix errors and try again.
```
### Cause
The optimizer reads its input from `${project.build.directory}/classes`, the
directory it also writes its `.min` output to, and the root `pom.xml` excludes
only `**/jquery*.js`. On a build without `clean`, the `.min.js` and `.min.css`
files of the previous run are therefore minified again, as `*.min.min.js` and
`*.min.min.css`. The log of the second run shows it, e.g. `Optimize JS file
wicket-ajax-jquery.min.js ...`.
Most files survive being minified twice, but `wicket-veil.js` uses `for ...
of` with destructuring, so Closure injects its `$jscomp` polyfills, including
`@define` constants, into `wicket-veil.min.js`. Compiling that output again
redefines those constants, which Closure reports as an error.
Modules that do get past the optimizer ship the doubled files: after the
second run, the installed `wicket-core` jar contains 9 `*.min.min.*` entries,
e.g. `wicket-ajax-jquery.min.min.js`.
CI always builds from a clean checkout, so it never sees this.
### Suggested fix
Exclude `**/*.min.js` and `**/*.min.css` in the optimizer's `resourcesSet`
in the root `pom.xml`, next to the existing `**/jquery*.js` exclusion.
This replaces #1718, whose title describes this problem but whose
description is about an unrelated javadoc failure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]