Skip to content
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

Maven4 is missing org.codehaus.plexus.util.FileUtils #87

Closed
TomerFi opened this issue Jan 12, 2022 · 4 comments · Fixed by #88
Closed

Maven4 is missing org.codehaus.plexus.util.FileUtils #87

TomerFi opened this issue Jan 12, 2022 · 4 comments · Fixed by #88

Comments

@TomerFi
Copy link
Collaborator

TomerFi commented Jan 12, 2022

I haven't had a chance to investigate this yet,
I just bumped into this, and I figured it requires early reporting.

All I can say now is that testing with this plugin in a modular environment breaks in maven 4:

  • Works well in a non-modular environment.
  • Works well using maven 3.8.4.
  • Same result for both manual and injected executions.
[ERROR] Failed to execute goal de.sormuras.junit:junit-platform-maven-plugin:1.1.5:launch (injected-launch) on project adr-annotations: Execution injected-launch of goal de.sormuras.junit:junit-platform-maven-plugin:1.1.5:launch failed: A required class was missing while executing de.sormuras.junit:junit-platform-maven-plugin:1.1.5:launch: org/codehaus/plexus/util/FileUtils
[ERROR] -----------------------------------------------------
[ERROR] realm =    extension>de.sormuras.junit:junit-platform-maven-plugin:1.1.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/tomerfi/.m2/repository/de/sormuras/junit/junit-platform-maven-plugin/1.1.5/junit-platform-maven-plugin-1.1.5.jar
[ERROR] urls[1] = file:/home/tomerfi/.m2/repository/de/sormuras/junit/junit-platform-isolator/1.0.0-M10/junit-platform-isolator-1.0.0-M10.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : org.codehaus.plexus.util.FileUtils

Maven 4 is still in development, snapshot instructions are available here.

I'm guessing maven 4 stopped using org.codehaus.plexus:plexus-utils,
we're using it transitively here.

If that's the case, we can either add it to our pom,
of figure out another way to copy the entire directory structure.

Perhaps @mthmulders can help shed some light on if and why maven 4 stopped using plexus-utils?
🙂

@mthmulders
Copy link

I've just checked the master branch of Maven, and it still has a dependency on plexus-utils: mvn dependency:tree -Dincludes="*:plexus-utils".

In this project, I see plexus-utils has "provided" scope - which means that you can compile against it but it will not be packaged. This is often used for e.g. Servlet API - the Web Container will provide that class at runtime, no need to ship it with a web application. Personally, I think I'd rather not use it for situations where I'm relying on code from a transitive dependency, but that's my opinion...

Also, I'm not sure it's a good idea for Maven Plugins to do it this way. @khmarbaise, I see you've contributed to this project before, care to share some light?

@rmannibucau
Copy link
Collaborator

This class is not exported (https://github.com/apache/maven/blob/master/maven-core/src/main/resources/META-INF/maven/extension.xml#L81) so it must be replaced. Due to the plugin usage i guess a Files.walk* would replace it trivially.

@TomerFi
Copy link
Collaborator Author

TomerFi commented Jan 13, 2022

Thank you both!.

Yes, we were declaring plexus-utils with the provided scope,
assuming it will be provided by maven,
removing the scope limitation would have probably resolved this issue.

Nevertheless, there's no point in using plexus-utils just for copyDirectoryStructure,
as said above me, this can be easily accomplished using Files.walk.

I pushed #88 with these modifications.
😃

@sormuras
Copy link
Owner

Copying files could and should be avoided ... methinks. Feels like a band-aid kind of operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants