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

Fix compatibility with Maven 3.9 #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blutorange
Copy link

Since Maven 3.9, plexus-utils are not injected automatically anymore. Plugins are now required to declare plexus-utils as an explicit dependency if they need to use it. See https://maven.apache.org/docs/3.9.0/release-notes.html

Maven 2.x was auto-injecting an ancient version of plexus-utils dependency into the plugin classpath, and Maven 3.x continued doing this to preserve backward compatibility. Starting with Maven 3.9, it does not happen anymore. This change may lead to plugin breakage. The fix for affected plugin maintainers is to explicitly declare a dependency on plexus-utils. The workaround for affected plugin users is to add this dependency to plugin dependencies until issue is fixed by the affected plugin maintainer. See MNG-6965.

Since Maven 3.9, plexus-utils are not injected automatically anymore. Plugins are now required to declare plexus-utils as an explicit dependency if they need to use it. See https://maven.apache.org/docs/3.9.0/release-notes.html

> Maven 2.x was auto-injecting an ancient version of plexus-utils dependency into the plugin classpath, and Maven 3.x continued doing this to preserve backward compatibility. Starting with Maven 3.9, it does not happen anymore. This change may lead to plugin breakage. The fix for affected plugin maintainers is to explicitly declare a dependency on plexus-utils. The workaround for affected plugin users is to add this dependency to plugin dependencies until issue is fixed by the affected plugin maintainer. See MNG-6965.
@melloware
Copy link

This plugin looks dead? No commits in 7 years?

@blutorange
Copy link
Author

Seems pretty much dead yes. I did make fork of this for closure compiler that fixes bugs and updates closure compiler to the latest version. It doesn't do CSS since I like plugins to focus on one task, and YUI compressor also seems outdated.

I'm not aware of any good, up-to-date CSS minifier for Java. There's libsass-maven-plugin, but libsass is deprecated.

The frontend-maven-plugin works by running arbitrary npm or yarn tasks, but minifiers written in Java on nodeJS tend to be slow. We are currently using that plugin + webpack for our project, and it takes about 3/4 of the entire build time. And some of my colleagues running Windows tell me it's even slower there.

Esbuild might also be worth a look. It's a bundler written in Go with a native binary that's much faster. It can be downloaded and executed via frontend-maven-plugin

@blutorange
Copy link
Author

Also, as stated in the link, this particular issue can be worked around by adding a <dependency> entry to the plugin in your pom. It's not really a permanent solution though since (a) who knows what will break with the release of Maven 4 and beyond, and (b) there are already many bugs related to the outdated closure compiler version.

@melloware
Copy link

melloware commented Apr 19, 2023

You can use this it does JS and CSS:
https://github.com/primefaces-extensions/resources-optimizer-maven-plugin

It has a custom fork of the CSSCompressor from YUI that has tons of bugs fixed and modernized.

@egeiter
Copy link

egeiter commented Nov 15, 2023

In addition to @blutorange 's explanation above:

Also, as stated in the link, this particular issue can be worked around by adding a <dependency> entry to the plugin in your pom. It's not really a permanent solution though since (a) who knows what will break with the release of Maven 4 and beyond, and (b) there are already many bugs related to the outdated closure compiler version.

I'd like to share with you the specific workaround in the pom.xml which solved the issue for me:

<plugin>
    <groupId>com.samaxes.maven</groupId>
    <artifactId>minify-maven-plugin</artifactId>
    <version>${minify-maven-plugin.version}</version>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>4.0.0</version>
        </dependency>
    </dependencies>
    <executions>
        ...
    </executions>
</plugin>

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 this pull request may close these issues.

None yet

3 participants