Skip to content

minify-maven-plugin fails on CI: A required class was missing while executing minify: org/codehaus/plexus/util/DirectoryScanner #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
php-coder opened this issue Jan 27, 2025 · 4 comments
Assignees
Labels
ADR/needed A decision has been made and it needs to be documented area/ci kind/bug kind/regression priority/urgent
Milestone

Comments

@php-coder
Copy link
Owner

Yesterday, execution of the integration tests on GitHub Actions have started to fail:

Error:  Failed to execute goal com.samaxes.maven:minify-maven-plugin:1.7.6:minify (minify-resources) on project mystamps: Execution minify-resources of goal com.samaxes.maven:minify-maven-plugin:1.7.6:minify failed: A required class was missing while executing com.samaxes.maven:minify-maven-plugin:1.7.6:minify: org/codehaus/plexus/util/DirectoryScanner
Error:  -----------------------------------------------------
Error:  realm =    plugin>com.samaxes.maven:minify-maven-plugin:1.7.6
Error:  strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
Error:  urls[0] = file:/home/runner/.m2/repository/com/samaxes/maven/minify-maven-plugin/1.7.6/minify-maven-plugin-1.7.6.jar
Error:  urls[1] = file:/home/runner/.m2/repository/com/yahoo/platform/yui/yuicompressor/2.4.8/yuicompressor-2.4.8.jar
Error:  urls[2] = file:/home/runner/.m2/repository/rhino/js/1.7R2/js-1.7R2.jar
Error:  urls[3] = file:/home/runner/.m2/repository/com/google/javascript/closure-compiler/v20161024/closure-compiler-v20161024.jar
Error:  urls[4] = file:/home/runner/.m2/repository/com/google/javascript/closure-compiler-externs/v20161024/closure-compiler-externs-v20161024.jar
Error:  urls[5] = file:/home/runner/.m2/repository/args4j/args4j/2.33/args4j-2.33.jar
Error:  urls[6] = file:/home/runner/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar
Error:  urls[7] = file:/home/runner/.m2/repository/com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2.jar
Error:  urls[8] = file:/home/runner/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
Error:  urls[9] = file:/home/runner/.m2/repository/com/google/jsinterop/jsinterop-annotations/1.0.0/jsinterop-annotations-1.0.0.jar
Error:  urls[10] = file:/home/runner/.m2/repository/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar
Error:  Number of foreign imports: 1
Error:  import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
Error:  
Error:  -----------------------------------------------------: org.codehaus.plexus.util.DirectoryScanner

Log: https://github.com/php-coder/mystamps/actions/runs/12975771490/job/36187232332

But tests worked 10 days ago: https://github.com/php-coder/mystamps/actions/runs/12830200842/job/35777833839

Also, they work on my machine (macos).

@php-coder php-coder added this to the 0.4.8 milestone Jan 27, 2025
@php-coder php-coder self-assigned this Jan 27, 2025
@php-coder
Copy link
Owner Author

php-coder commented Jan 27, 2025

Here what have changed:

 Runner Image
   Image: ubuntu-20.04
-  Version: 20250105.1.0
-  Included Software: https://github.com/actions/runner-images/blob/ubuntu20/20250105.1/images/ubuntu/Ubuntu2004-Readme.md
-  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu20%2F20250105.1
+  Version: 20250120.2.0
+  Included Software: https://github.com/actions/runner-images/blob/ubuntu20/20250120.2/images/ubuntu/Ubuntu2004-Readme.md
+  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu20%2F20250120.2
 Runner Image Provisioner
   2.0.414.1

@php-coder php-coder added kind/bug kind/regression ADR/needed A decision has been made and it needs to be documented labels Jan 27, 2025
@php-coder
Copy link
Owner Author

It caused by Maven update (3.8.8 => 3.9.9) (see actions/runner-images#11093). Here is also an explanation why this update triggered an error: https://stackoverflow.com/questions/75652635/a-required-class-was-missing-while-executing-maven-plugin-with-github-action

@php-coder
Copy link
Owner Author

php-coder commented Jan 27, 2025

In order to fix the build, we can:

  1. update Maven to the same version (Update Maven to 3.9.9 #1542), reproduce the issue locally and apply a workaround
  2. just apply a workaround and check whether it works on CI
  3. consider replacing the plugin by one of it's alternatives/forks
  4. pin Maven version, by using mvnw on CI (Use mvnw in build scripts #1064)

The last approach didn't really solve the issue but give us more time. Also it will make our builds more stable in future.

@php-coder
Copy link
Owner Author

See also: samaxes/minify-maven-plugin#176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR/needed A decision has been made and it needs to be documented area/ci kind/bug kind/regression priority/urgent
Projects
None yet
Development

No branches or pull requests

1 participant