A second build without clean fails in resources-optimizer-maven-plugin because minified files are minified again

Đang mở Phù hợp với người mới
#1,832 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@papegaaij đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #1833 của @papegaaij — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với resourcesSet của optimizer trong pom.xml ở thư mục gốc và quy tắc loại trừ **/jquery*.js hiện có. Tái hiện bằng hai lệnh Maven trong issue, lần đầu có clean, lần sau không có. Loại trừ **/*.min.js và **/*.min.css; hoàn tất khi lần build thứ hai thành công mà không xử lý các tệp đã minify từ trước hoặc thêm mục *.min.min.* vào các JAR.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Java
Star
799
Fork
421
Merge trung bình
20 giờ 5 phút
Pull request đã merge (30 ngày)
125

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/wicket

Tất cả issue của apache/wicket

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.